WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

MongoDB - Limit Records


MongoDB - Limit Records discover ways to restrict data the use of MongoDB.

The Limit() Method

To restriction the statistics in MongoDB, you want to apply restrict() technique.The method accepts one variety kind argument

Syntax

There are following fundamental syntax of limit() approach
>db.COLLECTION_NAME.Locate().Restriction(NUMBER)

Example

Consider the collection myycol has the subsequent statistics.
 "_id" : ObjectId(LeDrYka$3q9w5), "title":"MongoDB"
 "_id" : ObjectId(LeDrYka$3q9w6), "identify":"NoSQL Overview"
 "_id" : ObjectId(LeDrYka$3q9w7), "identify":"Welookups"
Following example will show only files whilst querying the record.
>db.mycol.find(,"identify":1,_id:0).restriction(2)
"title":"MongoDB Overview"
"identify":"NoSQL Overview"
>




Welookups is optimized for learning.Copy right 2018 - 2019 kumar aditya singh .
All Right Reserved and you agree to have read and accepted our term and condition.
All Rights Reserved.