// All below works User.find((obj) => obj._id === 1) User.find({ _id: 1 }) User.find({ username: "lennart" }) User.find(1) // { // _id: 1, // username: "lennart" // }
If the id is not passed:
User.find() // [{ _id: 1, username: "lennart" }]
Last updated 1 year ago
Parameter
Description
Object | String | Number | Function
In case of a specific search, use the Object or a Function with the parameters you are looking for in the document
Returns
Object
The data object that was sought
Array
Returns the entire database if an id is not passed in find