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

Function _validate_index_key_pair

pymongo/helpers_shared.py:204–212  ·  view source on GitHub ↗
(key: Any, value: Any)

Source from the content-addressed store, hash-verified

202
203
204def _validate_index_key_pair(key: Any, value: Any) -> None:
205 if not isinstance(key, str):
206 raise TypeError(f"first item in each key pair must be an instance of str, not {type(key)}")
207 if not isinstance(value, (str, int, abc.Mapping)):
208 raise TypeError(
209 "second item in each key pair must be 1, -1, "
210 "'2d', or another valid MongoDB index specifier."
211 f", not {type(value)}"
212 )
213
214
215def _check_command_response(

Callers 1

_index_documentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected