Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Jokes
Docs Menu
Docs Home
/ / /

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
  1. If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

  2. If it's not already displayed, select your project from the Projects menu in the navigation bar.

  3. In the sidebar, click Data Explorer under the Database heading.

    The Data Explorer displays.

Note

You can also go to the Clusters page, and click Data Explorer under the Shortcuts heading.

2
  1. Select the collection.

  2. In the Query Bar, click Options.

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

  4. 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.

$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 }
);
Atlas Limit Option
$limit : 10

See the limit entry in the MongoDB Manual.

Back

Skip Documents