mongodb ORing and ANDing query mongodb ORing and ANDing query mongodb mongodb

mongodb ORing and ANDing query


By default, all elements in a mongodb query use the and operator. You can specify an or operator using the { "$or": [ ... ] } construct, as described in the documentation.

Your query will be :

{ "$or": [ { "country": "c", "area": "a" }, { "country": "c1", "area": "b1" } ] }