This PR resolves #24 by handling the Query limit and sorts fields inside MongoDriver.
For select queries:
The Query.sorts array is used to build a sort document in the following format: { "field1": 1, "field2": -1, ... } (depending on sort order), and passed to MongoKitten's find method.
If Query.limit is set, the count and offset parameters are passed directly to MK find.
For delete commands:
If no filters are set and limit is 0 or not set, the whole collection is dropped (previous behavior).
If there are filters and the limit is 0 or not set, every matching document is removed (again, previous behavior)
If the limit is 1, a single matching document is removed.
Every other limit value is considered invalid and an error is thrown before calling MK. (This is to comply with the delete command's specification, which only allows these two values – and would fail on the driver level anyway.)
This PR resolves #24 by handling the Query limit and sorts fields inside MongoDriver.
For
select
queries:Query.sorts
array is used to build a sort document in the following format:{ "field1": 1, "field2": -1, ... }
(depending on sort order), and passed to MongoKitten'sfind
method.Query.limit
is set, the count and offset parameters are passed directly to MKfind
.For
delete
commands: