I just realized the $and operator above is superfluous since
"
zoo.name" and "zoo.type" are different fields.
>db.collection.find({$or: [{"
zoo.name":"Bruno","zoo.type":"dog"}, {"
zoo.name": "Brownie","zoo.type":"cat"}]})
{ "_id" : 1, "zoo" : { "place" : "Brazil", "name" : "Bruno", "type" :
"dog" } }
{ "_id" : 2, "zoo" : { "place" : "Japan", "name" : "Brownie", "type" :
"cat" } }
I can also think of a way to do this query with the new aggregation
framework, which is available in MongoDB version 2.2. I'll keep
thinking about the best way to solve this problem, but please let me
know if I missed the mark and you're attempting to do something
different.
New aggregation framework:
http://docs.mongodb.org/manual/reference/aggregation/#_S_match