Docs Menu

Docs HomeView & Analyze DataMongoDB Compass

Limit the Number of Returned Documents

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

To specify the limit:

  1. In the Query Bar, 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.

    Results of specifying query limit
    click to enlarge

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

See the limit entry in the MongoDB Manual.

$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
←  Skip a Number of DocumentsView Query Performance →