Skip to content

Commit 7f43ef4

Browse files
remove session handling code
1 parent e69e32d commit 7f43ef4

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
@@ -238,15 +238,8 @@ export class Db {
238238
name: string,
239239
options?: CreateCollectionOptions
240240
): Promise<Collection<TSchema>> {
241-
options = resolveOptions(this, { ...options });
242-
if (options.session) {
243-
return await createCollections<TSchema>(this, name, options);
244-
}
245-
246-
return await this.client.withSession({ explicit: false }, async session => {
247-
options.session = session;
248-
return await createCollections<TSchema>(this, name, options);
249-
});
241+
options = resolveOptions(this, options);
242+
return await createCollections<TSchema>(this, name, options);
250243
}
251244

252245
/**
@@ -361,13 +354,13 @@ export class Db {
361354
): ListCollectionsCursor<CollectionInfo>;
362355
listCollections<
363356
T extends Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo =
364-
| Pick<CollectionInfo, 'name' | 'type'>
365-
| CollectionInfo
357+
| Pick<CollectionInfo, 'name' | 'type'>
358+
| CollectionInfo
366359
>(filter?: Document, options?: ListCollectionsOptions & Abortable): ListCollectionsCursor<T>;
367360
listCollections<
368361
T extends Pick<CollectionInfo, 'name' | 'type'> | CollectionInfo =
369-
| Pick<CollectionInfo, 'name' | 'type'>
370-
| CollectionInfo
362+
| Pick<CollectionInfo, 'name' | 'type'>
363+
| CollectionInfo
371364
>(
372365
filter: Document = {},
373366
options: ListCollectionsOptions & Abortable = {}
@@ -412,15 +405,8 @@ export class Db {
412405
* @param options - Optional settings for the command
413406
*/
414407
async dropCollection(name: string, options?: DropCollectionOptions): Promise<boolean> {
415-
options = resolveOptions(this, { ...options });
416-
if (options.session) {
417-
return await dropCollections(this, name, options);
418-
}
419-
420-
return await this.client.withSession({ explicit: false }, async session => {
421-
options.session = session;
422-
return await dropCollections(this, name, options);
423-
});
408+
options = resolveOptions(this, options);
409+
return await dropCollections(this, name, options);
424410
}
425411

426412
/**

0 commit comments

Comments
 (0)