Skip to content

Commit ba78a82

Browse files
committed
Cast to string before performing regexMatch.
1 parent 27eb10b commit ba78a82

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

django_mongodb/query_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ def process_rhs(node, compiler, connection):
4848
def regex_match(field, value, regex, *re_args, **re_kwargs):
4949
regex = re.compile(regex % re.escape(value), *re_args, **re_kwargs)
5050
options = "i" if regex.flags & re.I else ""
51-
return {"$regexMatch": {"input": field, "regex": regex.pattern, "options": options}}
51+
return {
52+
"$regexMatch": {"input": {"$toString": field}, "regex": regex.pattern, "options": options}
53+
}

0 commit comments

Comments
 (0)