I'm building regex queries for mongo
s_list = [f"/^.*{x}.*/i" for x in s_list]
print(s_list)
query: dict = resumes_collection.find({
"first_name": {
"$in": s_list
},
})
This regex is supposed to get all data regardless of case sensitivity
etc if we have loop in the database
if we enter ^.*OP.*/i or ^.*oO.*/i will return loop in either case
Currently this returns nothing.
https://www.mongodb.com/docs/manual/reference/operator/query/regex/
Docs for reference. Using motor to interact with mongodb, motor runs pymongo under the hood
[f"/^.*{x}.*/i" for x in s_list]. Remove the first line and try"first_name": { "$regex": re.compile("|".join(s_list), re.I) }.