MongoDB - select limited records/documents

Professionaluser
Posted by Professionaluser under Sql Server category on | Points: 40 | Views : 312
limit() method can be used to fetch only top N documents from a collection in MongoDB.

>db.CollectionName.find({}).limit(2)


results the top 2 documents from the specified collection

Comments or Responses

Login to post response