MongoDB Limit
MongoDB limit() function is used to limit the number of results returned.
Syntax
db.collection.find().limit(number)
It accepts only one argument, i.e. number of the result. It is a positive integer that specify maximum number of result return.
Example
Suppose we have the following students data.
The following query returns only three documents of students data.
db.students.find().limit(3);