I have a list of distinct numbers.
lst = [123,252,812,135]
I want to perform an aggregation operation such that my $match looks like the following:
{"$match":{"Var":{"$in":lst}}}
The var field in MongoDb records is a string containing numbers:
e.g. "abc123", "haaofalfa812", etc. I want to match this Var to a regular expression. If the variables in the lst were manually coded, i could've done this...
{"$match":{"Var":{"$in":[re.compile('.*123.*', re.IGNORECASE),re.compile('.*252.*', re.IGNORECASE),re.compile('.*812.*', re.IGNORECASE)]}}}
But since it is a lst already initialized, what should I do?
