Mongo allows queries like this:
{_id: /^84042/}
i.e. no $regex
keyword used.
How to pass the same regexes with pymongo
?
If I do
my_collection.find('_id', '/^84042/')
it finds nothing.
UPDATE
The point is that I don't know whether I use exact value or regex. Hence, any solution involving $regex
keyword or regex compiling is not applicable.
It should be the same as in mongo: just value spelling should differ.