0.0.6 • Published 11 years ago
mongodb-query-after v0.0.6
MongoDB Query After
after
support for queries instead of pagination.
This ticket has been filed in jira.mongodb.org as a feature as this would be better if done on the database instead of the client.
You should only use this if after
is actually used,
otherwise just use a regular query.
API
query()
var query = require('mongodb-query-after')
query(collection, criteria, options).toArray()
These are the same arguments as collection.find()
.
Currently, all fields are required.
The only difference is that there are two additional parameters for options
:
options.after
- Begins returning documents after the document with{_id: after}
.options.seek
- Begins searching from the top of the query. Will stop the query afterseek
documents have been searched, regardless whetherlimit
documents have been returned.
query().stream()
Returns a stream with only three events:
stream.on('error', function (err) {})
stream.on('end', function () {})
, also aliased asclose
for ubiquitystream.on('data', function (doc) {})
query().toArray(function (err, docs))
Equivalent to collection.find().toArray()
query().each(function (err, doc))
Equivalent to collection.find().each()