Reputation: 20929
In Mongo shell, one can find
documents for multiple values in the same field by
coll.find({blah: {$in: ["foo", "bar"]}});
Just wondering how to do this in PyMongo? Tried this but doesn't work:
coll.find({'blah': ['foo', 'bar']})
Upvotes: 2
Views: 2236
Reputation: 46593
Add quotes around field name and $in
operator:
coll.find({'blah': {'$in': ["foo", "bar"]}})
Upvotes: 3