Limit Records on Find Query

Author: Al-mamun Sarkar Date: 2020-09-11 14:59:07

In this lesson, I will show how to limit and skip records on MongoDB SELECT queries.

 

Query with LIMIT:

Syntax:

db.collection.find().limit(number)

Example:

db.employees.find().limit(2)

 

Limit and skip:

 

 Syntax:

db.collection.find().limit(number).skip(number)

Example:

db.employees.find().limit(2).skip(2)