Limit Records on Find Query

Limit Records on Find Query

Instructor-svgAl-Mamun Sarkar
Sep 11 , 2020

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)

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram