Rishi
Rishi

Reputation: 7

AND operator in MongoDb Not retrieving proper data when Querying with ObjectId

I'm trying to retrieve documents which can satisfy all the conditions in this query from a embedded document in an array.It's retrieving documents of any of the condition satisfied.

db.getCollection('CollectionName').find(
    { $and: [{ "users.type" : "user" },
       { "users.status" : "2"},
       {"users.userId" : ObjectId("Some Object Id")} ]}

Upvotes: 0

Views: 31

Answers (0)

Related Questions