1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | 1 1 1 90 1 1 12 12 12 1 14 1 8 1 5 1 9 1 20 1 10 10 1 | 'use strict'; /** * Module dependencies */ var Collection = require('./collection'); var utils = require('../utils'); function NodeCollection (col) { this.collection = col; } /** * inherit from collection base class */ utils.inherits(NodeCollection, Collection); /** * find(match, options, function(err, docs)) */ NodeCollection.prototype.find = function (match, options, cb) { this.collection.find(match, options, function (err, cursor) { Iif (err) return cb(err); cursor.toArray(cb); }); } /** * findOne(match, options, function(err, doc)) */ NodeCollection.prototype.findOne = function (match, options, cb) { this.collection.findOne(match, options, cb); } /** * count(match, options, function(err, count)) */ NodeCollection.prototype.count = function (match, options, cb) { this.collection.count(match, options, cb); } /** * distinct(prop, match, options, function(err, count)) */ NodeCollection.prototype.distinct = function (prop, match, options, cb) { this.collection.distinct(prop, match, options, cb); } /** * update(match, update, options, function(err[, result])) */ NodeCollection.prototype.update = function (match, update, options, cb) { this.collection.update(match, update, options, cb); } /** * remove(match, options, function(err[, result]) */ NodeCollection.prototype.remove = function (match, options, cb) { this.collection.remove(match, options, cb); } /** * findAndModify(match, update, options, function(err, doc)) */ NodeCollection.prototype.findAndModify = function (match, update, options, cb) { var sort = Array.isArray(options.sort) ? options.sort : []; this.collection.findAndModify(match, sort, update, options, cb); } /** * aggregation(operators..., function(err, doc)) * TODO */ /** * Streams * TODO */ /** * Expose */ module.exports = exports = NodeCollection; |