MongoDB Query documents

In MongoDB, the db.collection.find() strategy is utilized to recover reports from an accumulation. This strategy gives back a cursor to the recovered records.

The db.collection.find() strategy peruses operations in mongoDB shell and recovers reports containing every one of their fields.

Note: You can likewise confine the fields to return in the recovered records by utilizing some particular inquiries. For instance: you can utilize the db.collection.findOne() system to give back a solitary archive. It works same as the db.collection.find() technique with a farthest point of 1.



Select All Documents in a Collection

An empty query document ({}) selects all documents in the collection:

db.inventory.find( {} )