Sometimes, we want to get full list of users with Mongoose.
In this article, we’ll look at how to get full list of users with Mongoose.
How to get full list of users with Mongoose?
To get full list of users with Mongoose, we can use the User.find
method.
For instance, we write
User.find({}, (err, users) => {
console.log(users)
});
to call User.find
with an empty object to retrieve the full list of users.
The full users list is stored in the users
parameter as an array.
Conclusion
To get full list of users with Mongoose, we can use the User.find
method.