We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e90b545 commit 823aee5Copy full SHA for 823aee5
src/collection.ts
@@ -527,12 +527,8 @@ export class Collection<TSchema extends Document = Document> {
527
// noCursorTimeout must be unset as well as batchSize.
528
// See: https://github.com/mongodb/specifications/blob/master/source/crud/crud.md#findone-api-details
529
opts.singleBatch = true;
530
- if (opts.noCursorTimeout != null) {
531
- delete opts.noCursorTimeout;
532
- }
533
- if (opts.batchSize != null) {
534
- delete opts.batchSize;
535
+ const { batchSize: _batchSize, noCursorTimeout: _noCursorTimeout, ...opts } = options;
+ opts.singleBatch = true;
536
const cursor = this.find(filter, opts).limit(1);
537
return await cursor.next();
538
}
0 commit comments