Skip to content

Commit 395d2b1

Browse files
Update src/collection.ts
Co-authored-by: Bailey Pearson <[email protected]>
1 parent c7f5f98 commit 395d2b1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/collection.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,8 @@ export class Collection<TSchema extends Document = Document> {
556556
// noCursorTimeout must be unset as well as batchSize.
557557
// See: https://github.com/mongodb/specifications/blob/master/source/crud/crud.md#findone-api-details
558558
opts.singleBatch = true;
559-
if (opts.noCursorTimeout != null) {
560-
delete opts.noCursorTimeout;
561-
}
562-
if (opts.batchSize != null) {
563-
delete opts.batchSize;
564-
}
559+
const { batchSize: _batchSize, noCursorTimeout: _noCursorTimeout, ...opts } = options;
560+
opts.singleBatch = true;
565561
const cursor = this.find(filter, opts).limit(1);
566562
return await cursor.next();
567563
}

0 commit comments

Comments
 (0)