The limit()
method in MongoDB allows you to specify the maximum number of documents that should be returned in a query result. By default, the limit()
method returns all documents in a collection.
But what if you use limit(0)
?
Instead of returning 0 records, it will return all the records present in the collection.
This happens because MongoDB treats 0 in limit()
as infinity
.
Top comments (0)