Query.prototype.find()

Parameters
  • [filter] «Object|ObjectId» mongodb selector. If not specified, returns all documents.

  • [callback] «Function»

Returns:
  • «Query» this

Find all documents that match selector. The result will be an array of documents.

If there are too many documents in the result to fit in memory, use Query.prototype.cursor()

Example

  1. // Using async/await
  2. const arr = await Movie.find({ year: { $gte: 1980, $lte: 1989 } });
  3. // Using callbacks
  4. Movie.find({ year: { $gte: 1980, $lte: 1989 } }, function(err, arr) {});