문제

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']})

도움이 되었습니까?

해결책

Add quotes around field name and $in operator:

coll.find({'blah': {'$in': ["foo", "bar"]}})
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top