Skip to content

Commit e50c11a

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

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
@@ -559,12 +559,8 @@ export class Collection<TSchema extends Document = Document> {
559559
// noCursorTimeout must be unset as well as batchSize.
560560
// See: https://github.com/mongodb/specifications/blob/master/source/crud/crud.md#findone-api-details
561561
opts.singleBatch = true;
562-
if (opts.noCursorTimeout != null) {
563-
delete opts.noCursorTimeout;
564-
}
565-
if (opts.batchSize != null) {
566-
delete opts.batchSize;
567-
}
562+
const { batchSize: _batchSize, noCursorTimeout: _noCursorTimeout, ...opts } = options;
563+
opts.singleBatch = true;
568564
const cursor = this.find(filter, opts).limit(1);
569565
return await cursor.next();
570566
}

0 commit comments

Comments
 (0)