Open ericrallen opened 5 years ago
Here is the relevant documentation from monk
: https://automattic.github.io/monk/docs/collection/find.html
Here's a StackOverflow answer showing it in practice: https://stackoverflow.com/a/19955252/656011
And here's the relevant code from monk
. It appears they use a polymorphic signature where the options
arguments is optional. I'm working on a PR now that mirrors their approach.
It doesn't seem to be possible to use
sort
orlimit
withbotkit-storage-mongo
because the exposed API does not accept options and pass them through tomonk
.This means you can only ever retrieve all of the items in a collection that meet your query parameters and they will be returned in an order determined by Mongo.
This is less than ideal for many usecases.
I plan to submit a PR to address this, but am not sure whether you'd rather the exposed API become polymorphic and allow the
options
to be an optional second parameter, which I think themonk
API supports, or if you'd prefer we break the convention of themonk
API and add theoptions
as an argument after the callback. Either of these options should be backwards compatible and not break any existing code that usesbotkit-storage-mongo
.