7 var Collection = require('./collection');
8 var utils = require('../utils');
10 function NodeCollection (col) {
11 this.collection = col;
12 this.collectionName = col.collectionName;
16 * inherit from collection base class
19 utils.inherits(NodeCollection, Collection);
22 * find(match, options, function(err, docs))
25 NodeCollection.prototype.find = function (match, options, cb) {
26 this.collection.find(match, options, function (err, cursor) {
27 if (err) return cb(err);
34 * findOne(match, options, function(err, doc))
37 NodeCollection.prototype.findOne = function (match, options, cb) {
38 this.collection.findOne(match, options, cb);
42 * count(match, options, function(err, count))
45 NodeCollection.prototype.count = function (match, options, cb) {
46 this.collection.count(match, options, cb);
50 * distinct(prop, match, options, function(err, count))
53 NodeCollection.prototype.distinct = function (prop, match, options, cb) {
54 this.collection.distinct(prop, match, options, cb);
58 * update(match, update, options, function(err[, result]))
61 NodeCollection.prototype.update = function (match, update, options, cb) {
62 this.collection.update(match, update, options, cb);
66 * remove(match, options, function(err[, result])
69 NodeCollection.prototype.remove = function (match, options, cb) {
70 this.collection.remove(match, options, cb);
74 * findAndModify(match, update, options, function(err, doc))
77 NodeCollection.prototype.findAndModify = function (match, update, options, cb) {
78 var sort = Array.isArray(options.sort) ? options.sort : [];
79 this.collection.findAndModify(match, sort, update, options, cb);
83 * var stream = findStream(match, findOptions, streamOptions)
86 NodeCollection.prototype.findStream = function(match, findOptions, streamOptions) {
87 return this.collection.find(match, findOptions);
91 * var cursor = findCursor(match, findOptions)
94 NodeCollection.prototype.findCursor = function(match, findOptions) {
95 return this.collection.find(match, findOptions);
99 * aggregation(operators..., function(err, doc))
107 module.exports = exports = NodeCollection;