Skip to content

Commit 823aee5

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

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
@@ -527,12 +527,8 @@ export class Collection<TSchema extends Document = Document> {
527527
// noCursorTimeout must be unset as well as batchSize.
528528
// See: https://github.com/mongodb/specifications/blob/master/source/crud/crud.md#findone-api-details
529529
opts.singleBatch = true;
530-
if (opts.noCursorTimeout != null) {
531-
delete opts.noCursorTimeout;
532-
}
533-
if (opts.batchSize != null) {
534-
delete opts.batchSize;
535-
}
530+
const { batchSize: _batchSize, noCursorTimeout: _noCursorTimeout, ...opts } = options;
531+
opts.singleBatch = true;
536532
const cursor = this.find(filter, opts).limit(1);
537533
return await cursor.next();
538534
}

0 commit comments

Comments
 (0)