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