How to retrieve documents from collections in MongoDB database?
We can retrieve documents from collections in MongoDB database using find() and findOne() method. With the help of the following example we will be learning how we can do that using find() method.
Example:
const users = await User.find( {
age: {
$gt: 30
},
role: "user",
gender: "male"
} );
console.log( { "users": users } );