mongodb-query-after

0.0.6 • Public • Published

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()

License

The MIT License (MIT)

Copyright (c) 2013 Jonathan Ong me@jongleberry.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i mongodb-query-after

Weekly Downloads

1

Version

0.0.6

License

MIT

Last publish

Collaborators

  • jongleberry