KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have mongo collection like below { "auther" : "xyz" , "location" : "zzz" , "books" : [ {"book1" : "b1" , "date" : 2-3-00} , {"book1" : "b2" , "date" : 4-9-00} ] } { "auther" : "pqr", "location" : "zzz" , "books" : [ {"book1" : "b1" , "date" : 2-4-00} ] } I want to get the only the date of book b1 and author xyz . i have make query like below db.coll.find({"auther" : "xyz" , "books.book1" : "b1"} , {"books.date" : 1}) but it's gives output as follows "books" : {"date" : 2-4-00} , "books" : {"date" : 4-9-00} I want to get the only the date of book b1 and other xyz .means only "books" : {"date" : 2-4-00} is it possible in mongo or am I doing something wrong?
Tags (comma-separated)
Save Edits
Cancel