find
noun
say it: “FYND” /ˈfaɪnd/
The MongoDB method that returns the documents matching a filter, or every document with an empty filter.
What does find do?
find returns the documents matching a filter (all of them with {}); findOne returns just the first.
db.recipes.find({ category: 'Dessert' })
db.recipes.findOne({ _id: recipeId })
In a sentence
- “In Node, add .toArray() after find to get the documents as an array.”
- “find({ organic: true }) returns every organic vendor.”
Level: Apprentice · More MongoDB terms at this level
Updated