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

Function _make_name

bson/__init__.py:695–699  ·  view source on GitHub ↗

Make a 'C' string suitable for a BSON key.

(string: str)

Source from the content-addressed store, hash-verified

693
694
695def _make_name(string: str) -> bytes:
696 """Make a 'C' string suitable for a BSON key."""
697 if "\x00" in string:
698 raise InvalidDocument("BSON keys must not contain a NUL character")
699 return _utf_8_encode(string)[0] + b"\x00"
700
701
702def _encode_float(name: bytes, value: float, dummy0: Any, dummy1: Any) -> bytes:

Callers 1

_element_to_bsonFunction · 0.85

Calls 1

InvalidDocumentClass · 0.90

Tested by

no test coverage detected