WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

MongoDB - Projection


projection means choosing simplest the essential records instead of deciding on whole of the facts of a report. If a report has five fields and you want to show only three, then pick out only three fields from them..

MongoDB's discover() technique, defined in MongoDB Query Document accepts second optional parameter that is list of fields that you need to retrieve. In MongoDB, while you execute find() method

Syntax

The primary syntax of find() technique with projection is as follows
>db.COLLECTION_NAME.Discover(,KEY:1)

Example

Consider the collection mycol has the subsequent statistics
   "_id" : ObjectId(124asd1sd4ae12), "title":"MongoDB"
 "_id" : ObjectId(124asd1sd4ae13), "identify":"NoSQL "
 "_id" : ObjectId(124asd1sd4ae14), "name":"Welookups "
>db.Mycol.Find(,"title":1,_id:zero)
"identify":"MongoDB "
"identify":"NoSQL "
"identify":"Welookups "
>




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.