Skip to content

Commit f5ba98d

Browse files
committed
tweak validation rules
1 parent 5ec4e6c commit f5ba98d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bson/json_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def object_hook(dct, json_options=DEFAULT_JSON_OPTIONS):
508508
def _parse_legacy_regex(doc):
509509
pattern = doc["$regex"]
510510
# Check if this is the $regex query operator.
511-
if isinstance(pattern, Regex):
511+
if not isinstance(pattern, (str, bytes)):
512512
return doc
513513
flags = 0
514514
# PyMongo always adds $options but some other tools may not.

0 commit comments

Comments
 (0)