Skip to content

Commit

Permalink
docs(query): improve find() docs re: #7188
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Nov 1, 2018
1 parent 526f82d commit c1e2617
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -1759,15 +1759,17 @@ Query.prototype._find = function(callback) {
};

/**
* Finds documents.
*
* When no `callback` is passed, the query is not executed. When the query is executed, the result will be an array of documents.
* Find all documents that match `selector`. The result will be an array of documents.
*
* ####Example
*
* query.find({ name: 'Los Pollos Hermanos' }).find(callback)
* // Using async/await
* const arr = await Movie.find({ year: { $gte: 1980, $lte: 1989 } });
*
* @param {Object} [filter] mongodb selector
* // Using callbacks
* Movie.find({ year: { $gte: 1980, $lte: 1989 } }, function(err, arr) {});
*
* @param {Object} [filter] mongodb selector. If not specified, returns all documents.
* @param {Function} [callback]
* @return {Query} this
* @api public
Expand Down

0 comments on commit c1e2617

Please sign in to comment.