0.0.6 • Published 11 years ago

mongodb-query-after v0.0.6

Weekly downloads
2
License
-
Repository
github
Last release
11 years ago

MongoDB Query After Build Status

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 after seek documents have been searched, regardless whether limit documents have been returned.

query().stream()

Returns a stream with only three events:

  • stream.on('error', function (err) {})
  • stream.on('end', function () {}), also aliased as close for ubiquity
  • stream.on('data', function (doc) {})

query().toArray(function (err, docs))

Equivalent to collection.find().toArray()

query().each(function (err, doc))

Equivalent to collection.find().each()