Skip to content

Commit 85f02d3

Browse files
committed
chore: try with existing cursor logic
1 parent df1be41 commit 85f02d3

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/collection.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,9 @@ export class Collection<TSchema extends Document = Document> {
555555
options: Omit<FindOneOptions, ''> & Abortable = {}
556556
): Promise<WithId<TSchema> | null> {
557557
const opts = { ...options };
558+
// Explicitly set the limit to 1 and singleBatch to true for all commands, per the spec.
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
558561
opts.singleBatch = true;
559562
if (opts.noCursorTimeout != null) {
560563
delete opts.noCursorTimeout;
@@ -564,16 +567,6 @@ export class Collection<TSchema extends Document = Document> {
564567
}
565568
const cursor = this.find(filter, opts).limit(1);
566569
return await cursor.next();
567-
//await cursor.close();
568-
//return await executeOperation(
569-
// this.client,
570-
// new FindOneOperation(
571-
// this.s.db,
572-
// this.collectionName,
573-
// filter,
574-
// resolveOptions(this as TODO_NODE_3286, options)
575-
// )
576-
//);
577570
}
578571

579572
/**

test/integration/retryable-reads/retryable_reads.spec.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const UNIMPLEMENTED_APIS = [
1414

1515
const skippedTests = ['collection.listIndexes succeeds after retryable handshake network error'];
1616

17-
describe.only('Retryable Reads (unified)', function () {
17+
describe('Retryable Reads (unified)', function () {
1818
runUnifiedSuite(loadSpecTests(path.join('retryable-reads', 'unified')), ({ description }) => {
1919
for (const apiName of UNIMPLEMENTED_APIS) {
2020
if (description.toLowerCase().includes(apiName.toLowerCase())) {

0 commit comments

Comments
 (0)