@@ -2549,7 +2549,6 @@ async def _list_indexes(
25492549 self .with_options (codec_options = codec_options , read_preference = ReadPreference .PRIMARY ),
25502550 )
25512551 read_pref = (session and session ._txn_read_preference ()) or ReadPreference .PRIMARY
2552- explicit_session = session is not None
25532552
25542553 async def _cmd (
25552554 session : Optional [AsyncClientSession ],
@@ -2576,13 +2575,12 @@ async def _cmd(
25762575 cursor ,
25772576 conn .address ,
25782577 session = session ,
2579- explicit_session = explicit_session ,
25802578 comment = cmd .get ("comment" ),
25812579 )
25822580 await cmd_cursor ._maybe_pin_connection (conn )
25832581 return cmd_cursor
25842582
2585- async with self ._database .client ._tmp_session (session , False ) as s :
2583+ async with self ._database .client ._tmp_session (session ) as s :
25862584 return await self ._database .client ._retryable_read (
25872585 _cmd , read_pref , s , operation = _Op .LIST_INDEXES
25882586 )
@@ -2678,7 +2676,6 @@ async def list_search_indexes(
26782676 AsyncCommandCursor ,
26792677 pipeline ,
26802678 kwargs ,
2681- explicit_session = session is not None ,
26822679 comment = comment ,
26832680 user_fields = {"cursor" : {"firstBatch" : 1 }},
26842681 )
@@ -2900,7 +2897,6 @@ async def _aggregate(
29002897 pipeline : _Pipeline ,
29012898 cursor_class : Type [AsyncCommandCursor ], # type: ignore[type-arg]
29022899 session : Optional [AsyncClientSession ],
2903- explicit_session : bool ,
29042900 let : Optional [Mapping [str , Any ]] = None ,
29052901 comment : Optional [Any ] = None ,
29062902 ** kwargs : Any ,
@@ -2912,7 +2908,6 @@ async def _aggregate(
29122908 cursor_class ,
29132909 pipeline ,
29142910 kwargs ,
2915- explicit_session ,
29162911 let ,
29172912 user_fields = {"cursor" : {"firstBatch" : 1 }},
29182913 )
@@ -3018,13 +3013,12 @@ async def aggregate(
30183013 .. _aggregate command:
30193014 https://mongodb.com/docs/manual/reference/command/aggregate
30203015 """
3021- async with self ._database .client ._tmp_session (session , close = False ) as s :
3016+ async with self ._database .client ._tmp_session (session ) as s :
30223017 return await self ._aggregate (
30233018 _CollectionAggregationCommand ,
30243019 pipeline ,
30253020 AsyncCommandCursor ,
30263021 session = s ,
3027- explicit_session = session is not None ,
30283022 let = let ,
30293023 comment = comment ,
30303024 ** kwargs ,
@@ -3065,15 +3059,14 @@ async def aggregate_raw_batches(
30653059 raise InvalidOperation ("aggregate_raw_batches does not support auto encryption" )
30663060 if comment is not None :
30673061 kwargs ["comment" ] = comment
3068- async with self ._database .client ._tmp_session (session , close = False ) as s :
3062+ async with self ._database .client ._tmp_session (session ) as s :
30693063 return cast (
30703064 AsyncRawBatchCursor [_DocumentType ],
30713065 await self ._aggregate (
30723066 _CollectionRawAggregationCommand ,
30733067 pipeline ,
30743068 AsyncRawBatchCommandCursor ,
30753069 session = s ,
3076- explicit_session = session is not None ,
30773070 ** kwargs ,
30783071 ),
30793072 )
0 commit comments