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 0271eb4 commit e50c11aCopy full SHA for e50c11a
src/collection.ts
@@ -559,12 +559,8 @@ export class Collection<TSchema extends Document = Document> {
559
// noCursorTimeout must be unset as well as batchSize.
560
// See: https://github.com/mongodb/specifications/blob/master/source/crud/crud.md#findone-api-details
561
opts.singleBatch = true;
562
- if (opts.noCursorTimeout != null) {
563
- delete opts.noCursorTimeout;
564
- }
565
- if (opts.batchSize != null) {
566
- delete opts.batchSize;
567
+ const { batchSize: _batchSize, noCursorTimeout: _noCursorTimeout, ...opts } = options;
+ opts.singleBatch = true;
568
const cursor = this.find(filter, opts).limit(1);
569
return await cursor.next();
570
}
0 commit comments