To find all entries in userAccount but only have the email returned:
db.userAccount.find({},{"email":"1"});
|
To find all entries in userAccount from city "New York" and only have the email returned:
db.userAccount.find({"city","New York"},{"email":"1"});
|
0 can be used to exclude the field
More examples and references: http://docs.mongodb.org/manual/tutorial/project-fields-from-query-results/
No comments:
Post a Comment