I tried to use something like this in pymongo:
list(db[collectionName].find({}, {fieldName: {"$in": [value1, value2]}}))
but I get an error that its unsupported projection option. How can I correct it?
CodePudding user response:
When trying to match documents, the conditions go in query predicate and not in projection. So try refactoring the code as shown below:
list(db[collectionName].find({ fieldName: {"$in": [value1, value2]} }))