How to get all the documents from MongoDB

Getting entire data of a MongoDB collection is very simple. For example the following documents are in our Users collection… and we can get all the documents from our database using Users.find({}), this will…

Get data with MongoDB findById()

Now, if we need only the `username`, or only `firstName`, or only `username` and `email`, or all the data fields but not the `password`, or whatever you want…