Reputation:
I am doing this query to find the book with id "345" and which has a string "jack" in its owner array.
But it only lookes for the owner part and doesnt query id. Am i doing a syntax mistake?
Book.findOne({owner:{$in:["jack"]} },{_id:"345"},function(err,data)
Upvotes: 1
Views: 74
Reputation: 311835
Both the owner
and _id
properties of the find selector need to be in the same object:
Book.findOne({owner:{$in:["jack"]}, _id:"345"}, function(err,data) {...});
Upvotes: 1