Skip to content

Commit

Permalink
Allow limit, sort and skip conditions to be passed to find and findOne
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Apr 11, 2014
1 parent 5ac3fb5 commit 7edacff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ Model.prototype.find = function (conditions, options, callback) {
if (!_.isPlainObject(conditions)) conditions = this.downstreamID(conditions);
this.toSource(conditions);

this.collection.find(conditions).toArray((function (err, results) {
this.collection.find(conditions, { limit: options.limit, sort: options.sort, skip: options.skip }).toArray((function (err, results) {
if (err) {
this.emit('error', err);
return callback(err);
Expand Down Expand Up @@ -418,7 +418,7 @@ Model.prototype.findOne = Model.prototype.get = function (conditions, options, c
this.toSource(conditions);

var fromDB = (function() {
this.collection.findOne(conditions, (function (err, results) {
this.collection.findOne(conditions, { limit: options.limit, sort: options.sort, skip: options.skip }, (function (err, results) {
if (err) {
this.emit('error', err);
return callback(err);
Expand Down

0 comments on commit 7edacff

Please sign in to comment.