Some of my documents contain a field called status with a value of 404 . I do not want to return these files, so I use the $not operator:
query = { "venue_id": venue_id, "status": { "$not": 404 } }
However, I get an error message:
OperationFailure: database error: Can't canonicalize query: BadValue $not needs a regex or a document
Does this happen because some of the documents have this field? I do not want to use regex for speed reasons. How can I make this request correctly and efficiently?
mongodb
Diolor
source share