For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Read Documents

In MongoDB, a Read operation consists of querying the database. This page provides examples.

You can query documents in MongoDB with the following methods:

For more query examples, see:

As a cursor returns documents, other operations may run in the background and affect the results, depending on the read concern level. For details, see Read Isolation, Consistency, and Recency.

For reads to replica sets and replica set shards, read concern lets clients choose an isolation level for their reads. For more information, see Read Concern.

When you run a find operation with a MongoDB driver or mongosh, MongoDB returns a cursor that manages query results. Query results are not returned as an array of documents.

To learn how to iterate through documents in a cursor, see your driver's documentation. If you are using mongosh, see Iterate a Cursor in mongosh.

Earn a Skill Badge

Master "Query Optimization" for free!

Learn more

Rate this page