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

Method _aggregate

pymongo/synchronous/collection.py:2914–2942  ·  view source on GitHub ↗
(
        self,
        aggregation_command: Type[_AggregationCommand],
        pipeline: _Pipeline,
        cursor_class: Type[CommandCursor],  # type: ignore[type-arg]
        session: Optional[ClientSession],
        let: Optional[Mapping[str, Any]] = None,
        comment: Optional[Any] = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

2912
2913 @_csot.apply
2914 def _aggregate(
2915 self,
2916 aggregation_command: Type[_AggregationCommand],
2917 pipeline: _Pipeline,
2918 cursor_class: Type[CommandCursor], # type: ignore[type-arg]
2919 session: Optional[ClientSession],
2920 let: Optional[Mapping[str, Any]] = None,
2921 comment: Optional[Any] = None,
2922 **kwargs: Any,
2923 ) -> CommandCursor[_DocumentType]:
2924 if comment is not None:
2925 kwargs["comment"] = comment
2926 cmd = aggregation_command(
2927 self,
2928 cursor_class,
2929 pipeline,
2930 kwargs,
2931 let,
2932 user_fields={"cursor": {"firstBatch": 1}},
2933 )
2934
2935 return self._database.client._retryable_read(
2936 cmd.get_cursor,
2937 cmd.get_read_preference(session), # type: ignore[arg-type]
2938 session,
2939 retryable=not cmd._performs_write,
2940 operation=_Op.AGGREGATE,
2941 is_aggregate_write=cmd._performs_write,
2942 )
2943
2944 def aggregate(
2945 self,

Callers 2

aggregateMethod · 0.95
aggregate_raw_batchesMethod · 0.95

Calls 2

_retryable_readMethod · 0.45
get_read_preferenceMethod · 0.45

Tested by

no test coverage detected