top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

+2 votes
484 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 LinkedIn 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
...