File tree Expand file tree Collapse file tree 4 files changed +9
-14
lines changed Expand file tree Collapse file tree 4 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -240,7 +240,7 @@ async def _die_lock(self) -> None:
240
240
self ._sock_mgr = None
241
241
242
242
def _end_session (self ) -> None :
243
- if self ._session and self ._session ._implicit and not self . _session . _leave_alive :
243
+ if self ._session and self ._session ._implicit :
244
244
self ._session ._attached_to_cursor = False
245
245
self ._session ._end_implicit_session ()
246
246
self ._session = None
Original file line number Diff line number Diff line change @@ -1208,12 +1208,10 @@ async def _list_collection_names(
1208
1208
if not filter or (len (filter ) == 1 and "name" in filter ):
1209
1209
kwargs ["nameOnly" ] = True
1210
1210
1211
- cursor = await self ._list_collections_helper (session = session , ** kwargs )
1212
- results = [result ["name" ] async for result in cursor ]
1213
-
1214
- await cursor .close ()
1215
-
1216
- return results
1211
+ return [
1212
+ result ["name" ]
1213
+ async for result in await self ._list_collections_helper (session = session , ** kwargs )
1214
+ ]
1217
1215
1218
1216
async def list_collection_names (
1219
1217
self ,
Original file line number Diff line number Diff line change @@ -240,7 +240,7 @@ def _die_lock(self) -> None:
240
240
self ._sock_mgr = None
241
241
242
242
def _end_session (self ) -> None :
243
- if self ._session and self ._session ._implicit and not self . _session . _leave_alive :
243
+ if self ._session and self ._session ._implicit :
244
244
self ._session ._attached_to_cursor = False
245
245
self ._session ._end_implicit_session ()
246
246
self ._session = None
Original file line number Diff line number Diff line change @@ -1202,12 +1202,9 @@ def _list_collection_names(
1202
1202
if not filter or (len (filter ) == 1 and "name" in filter ):
1203
1203
kwargs ["nameOnly" ] = True
1204
1204
1205
- cursor = self ._list_collections_helper (session = session , ** kwargs )
1206
- results = [result ["name" ] for result in cursor ]
1207
-
1208
- cursor .close ()
1209
-
1210
- return results
1205
+ return [
1206
+ result ["name" ] for result in self ._list_collections_helper (session = session , ** kwargs )
1207
+ ]
1211
1208
1212
1209
def list_collection_names (
1213
1210
self ,
You can’t perform that action at this time.
0 commit comments