I want to do a PyMongo equivalent to vendor NOT IN ('Amazon', 'eBay', 'AliBaba')
.
I am able to get it to work in MongoDB by doing:
'vendor': {'$not': {'$in': [/^Amazon/, /^eBay/, /^AliBaba/]}}
This works.
In PyMongo no matter what I try, I am getting no result. It is not throwing any errors but not returning any results either.
Here is what I have tried:
1)
import re
vendor = {'$not': {'$in': [re.compile('^Amazon'), re.compile('^eBay'), re.compile('^AliBaba')]}}
2)
import re
vendor = {'$not': {'$in': [re.compile('.*Amazon.*'), re.compile('.*eBay.*'), re.compile('.*AliBaba.*')]}}
What am I missing? Why can't I get not in
work with PyMongo?