The main command used to query a collection from the mongo shell is db.<collection_name>.find(). If you are only interested in a single result, you can alternatively use db.<collection_name>.findOne(). The find() and findOne() commands have two basic parameters: the query (also referred to as filter) and the projection, as illustrated in the following diagram:
The result of a query is a cursor. The cursor is an iteration, which means you need to type the it helper command in the mongo shell to see the remaining results.
As mentioned here, the db.collection.find() shell method produces a cursor over which you can iterate to retrieve all results. There are a number of cursor methods that can be applied, which has the effect of modifying the final results. A number of examples in this section will demonstrate a few of the most important such methods. For more information, refer to https://docs.mongodb.com/manual/reference/method/js...