Skip to content

Commit 52cf0d4

Browse files
remove session handling code
1 parent 03266c1 commit 52cf0d4

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

src/db.ts

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,8 @@ export class Db {
239239
name: string,
240240
options?: CreateCollectionOptions
241241
): Promise<Collection<TSchema>> {
242-
options = resolveOptions(this, { ...options });
243-
if (options.session) {
244-
return await createCollections<TSchema>(this, name, options);
245-
}
246-
247-
return await this.client.withSession({ explicit: false }, async session => {
248-
options.session = session;
249-
return await createCollections<TSchema>(this, name, options);
250-
});
242+
options = resolveOptions(this, options);
243+
return await createCollections<TSchema>(this, name, options);
251244
}
252245

253246
/**
@@ -362,13 +355,13 @@ export class Db {
362355
): ListCollectionsCursor<CollectionInfo>;
363356
listCollections<
364357
T extends Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo =
365-
| Pick<CollectionInfo, 'name' | 'type'>
366-
| CollectionInfo
358+
| Pick<CollectionInfo, 'name' | 'type'>
359+
| CollectionInfo
367360
>(filter?: Document, options?: ListCollectionsOptions & Abortable): ListCollectionsCursor<T>;
368361
listCollections<
369362
T extends Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo =
370-
| Pick<CollectionInfo, 'name' | 'type'>
371-
| CollectionInfo
363+
| Pick<CollectionInfo, 'name' | 'type'>
364+
| CollectionInfo
372365
>(
373366
filter: Document = {},
374367
options: ListCollectionsOptions & Abortable = {}
@@ -413,15 +406,8 @@ export class Db {
413406
* @param options - Optional settings for the command
414407
*/
415408
async dropCollection(name: string, options?: DropCollectionOptions): Promise<boolean> {
416-
options = resolveOptions(this, { ...options });
417-
if (options.session) {
418-
return await dropCollections(this, name, options);
419-
}
420-
421-
return await this.client.withSession({ explicit: false }, async session => {
422-
options.session = session;
423-
return await dropCollections(this, name, options);
424-
});
409+
options = resolveOptions(this, options);
410+
return await dropCollections(this, name, options);
425411
}
426412

427413
/**

0 commit comments

Comments
 (0)