MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _parse_legacy_regex

Function _parse_legacy_regex

bson/json_util.py:528–537  ·  view source on GitHub ↗
(doc: Any, dummy0: Any)

Source from the content-addressed store, hash-verified

526
527
528def _parse_legacy_regex(doc: Any, dummy0: Any) -> Any:
529 pattern = doc["$regex"]
530 # Check if this is the $regex query operator.
531 if not isinstance(pattern, (str, bytes)):
532 return doc
533 flags = 0
534 # PyMongo always adds $options but some other tools may not.
535 for opt in doc.get("$options", ""):
536 flags |= _RE_OPT_TABLE.get(opt, 0)
537 return Regex(pattern, flags)
538
539
540def _parse_legacy_uuid(doc: Any, json_options: JSONOptions) -> Union[Binary, uuid.UUID]:

Callers

nothing calls this directly

Calls 2

RegexClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected