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

Function _query_impl

pymongo/message.py:426–454  ·  view source on GitHub ↗

Get an OP_QUERY message.

(
    options: int,
    collection_name: str,
    num_to_skip: int,
    num_to_return: int,
    query: Mapping[str, Any],
    field_selector: Optional[Mapping[str, Any]],
    opts: CodecOptions[Any],
)

Source from the content-addressed store, hash-verified

424
425
426def _query_impl(
427 options: int,
428 collection_name: str,
429 num_to_skip: int,
430 num_to_return: int,
431 query: Mapping[str, Any],
432 field_selector: Optional[Mapping[str, Any]],
433 opts: CodecOptions[Any],
434) -> tuple[bytes, int]:
435 """Get an OP_QUERY message."""
436 encoded = _dict_to_bson(query, False, opts)
437 if field_selector:
438 efs = _dict_to_bson(field_selector, False, opts)
439 else:
440 efs = b""
441 max_bson_size = max(len(encoded), len(efs))
442 return (
443 b"".join(
444 [
445 _pack_int(options),
446 bson._make_c_string(collection_name),
447 _pack_int(num_to_skip),
448 _pack_int(num_to_return),
449 encoded,
450 efs,
451 ]
452 ),
453 max_bson_size,
454 )
455
456
457def _query_compressed(

Callers 2

_query_compressedFunction · 0.85
_query_uncompressedFunction · 0.85

Calls 2

_dict_to_bsonFunction · 0.90
joinMethod · 0.45

Tested by

no test coverage detected