@@ -2549,7 +2549,6 @@ async def _list_indexes(
2549
2549
self .with_options (codec_options = codec_options , read_preference = ReadPreference .PRIMARY ),
2550
2550
)
2551
2551
read_pref = (session and session ._txn_read_preference ()) or ReadPreference .PRIMARY
2552
- explicit_session = session is not None
2553
2552
2554
2553
async def _cmd (
2555
2554
session : Optional [AsyncClientSession ],
@@ -2576,13 +2575,12 @@ async def _cmd(
2576
2575
cursor ,
2577
2576
conn .address ,
2578
2577
session = session ,
2579
- explicit_session = explicit_session ,
2580
2578
comment = cmd .get ("comment" ),
2581
2579
)
2582
2580
await cmd_cursor ._maybe_pin_connection (conn )
2583
2581
return cmd_cursor
2584
2582
2585
- async with self ._database .client ._tmp_session (session , False ) as s :
2583
+ async with self ._database .client ._tmp_session (session ) as s :
2586
2584
return await self ._database .client ._retryable_read (
2587
2585
_cmd , read_pref , s , operation = _Op .LIST_INDEXES
2588
2586
)
@@ -2678,7 +2676,6 @@ async def list_search_indexes(
2678
2676
AsyncCommandCursor ,
2679
2677
pipeline ,
2680
2678
kwargs ,
2681
- explicit_session = session is not None ,
2682
2679
comment = comment ,
2683
2680
user_fields = {"cursor" : {"firstBatch" : 1 }},
2684
2681
)
@@ -2900,7 +2897,6 @@ async def _aggregate(
2900
2897
pipeline : _Pipeline ,
2901
2898
cursor_class : Type [AsyncCommandCursor ], # type: ignore[type-arg]
2902
2899
session : Optional [AsyncClientSession ],
2903
- explicit_session : bool ,
2904
2900
let : Optional [Mapping [str , Any ]] = None ,
2905
2901
comment : Optional [Any ] = None ,
2906
2902
** kwargs : Any ,
@@ -2912,7 +2908,6 @@ async def _aggregate(
2912
2908
cursor_class ,
2913
2909
pipeline ,
2914
2910
kwargs ,
2915
- explicit_session ,
2916
2911
let ,
2917
2912
user_fields = {"cursor" : {"firstBatch" : 1 }},
2918
2913
)
@@ -3018,13 +3013,12 @@ async def aggregate(
3018
3013
.. _aggregate command:
3019
3014
https://mongodb.com/docs/manual/reference/command/aggregate
3020
3015
"""
3021
- async with self ._database .client ._tmp_session (session , close = False ) as s :
3016
+ async with self ._database .client ._tmp_session (session ) as s :
3022
3017
return await self ._aggregate (
3023
3018
_CollectionAggregationCommand ,
3024
3019
pipeline ,
3025
3020
AsyncCommandCursor ,
3026
3021
session = s ,
3027
- explicit_session = session is not None ,
3028
3022
let = let ,
3029
3023
comment = comment ,
3030
3024
** kwargs ,
@@ -3065,15 +3059,14 @@ async def aggregate_raw_batches(
3065
3059
raise InvalidOperation ("aggregate_raw_batches does not support auto encryption" )
3066
3060
if comment is not None :
3067
3061
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 :
3069
3063
return cast (
3070
3064
AsyncRawBatchCursor [_DocumentType ],
3071
3065
await self ._aggregate (
3072
3066
_CollectionRawAggregationCommand ,
3073
3067
pipeline ,
3074
3068
AsyncRawBatchCommandCursor ,
3075
3069
session = s ,
3076
- explicit_session = session is not None ,
3077
3070
** kwargs ,
3078
3071
),
3079
3072
)
0 commit comments