Model.find()

Parameters
Returns:
  • «Query»

Finds documents.

Mongoose casts the filter to match the model’s schema before the command is sent. See our query casting tutorial for more information on how Mongoose casts filter.

Examples:

  1. // find all documents
  2. await MyModel.find({});
  3. // find all documents named john and at least 18
  4. await MyModel.find({ name: 'john', age: { $gte: 18 } }).exec();
  5. // executes, passing results to callback
  6. MyModel.find({ name: 'john', age: { $gte: 18 }}, function (err, docs) {});
  7. // executes, name LIKE john and only selecting the "name" and "friends" fields
  8. await MyModel.find({ name: /john/i }, 'name friends').exec();
  9. // passing options
  10. await MyModel.find({ name: /john/i }, null, { skip: 10 }).exec();