I am storing regex expressions in MongoDB and would like to use them for queries.
Documents structure:
{
"name": "foo",
"regex_expression": "^[^@ ]+@(bar\\.com)$"
}
I tried the following query but it doesn't work.
db.collection.find({$expr: {$regex: ["[email protected]", "$regex_expression]}})
Is it possible to do this kind of query?