top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

MongoDB: How does projection work in mongoDB system and why it is required ?

+2 votes
96 views
MongoDB: How does projection work in mongoDB system and why it is required ?
posted Jun 24, 2015 by Vikram Singh

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

The objective of projection is to select/show few fields of selected document. For example: One department has so many managers and with the different key skills. Assume department head wants to see list of manager's who have particular skill set but does not see irrelevant information like their permanent address, number of children etc.

Use command format to construct your query.
db.collection_name.find({ skill: "xyz" } , {name:1, children_details:0, salary_details:0})

answer Jun 26, 2015 by Ganesh
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...