Navigation

Limit the Number of Returned Documents

If the query bar has the Limit option, you can specify the maximum number of documents to return.

Set Documents to Return

To specify the limit:

  1. Click Options.

  2. Enter an integer representing the number of documents to return into the Limit field.

  3. Click Find to run the query and view the updated results.

    Note

    For query result sets larger than 1000 documents, Compass shows a sampling of the results. Otherwise, Compass shows the entire result set.

    For details on sampling, see the FAQ.

Clear the Query

To clear the query bar and the results of the query, click Reset.

To Learn More

See the limit entry in the MongoDB Manual.

How Does the Compass Query Compare to MongoDB and SQL Queries?

$skip corresponds to the LIMIT ... clause in a SQL SELECT statement.

Example

You have 3,235 articles. You would like to see a list of the first 10 articles.

SQL
SELECT * FROM article
LIMIT 10;
MongoDB Aggregation
db.article.aggregate(
  { $limit : 10 }
);
Compass Limit Option
$limit : 10