Skip to content

Commit 590ba68

Browse files
fix failing explain tests
1 parent fce1a86 commit 590ba68

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cursor/find_cursor.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type Document, Long } from '../bson';
22
import { MongoInvalidArgumentError, MongoTailableCursorError } from '../error';
3-
import type { ExplainVerbosityLike } from '../explain';
3+
import { Explain, type ExplainVerbosityLike } from '../explain';
44
import type { MongoClient } from '../mongo_client';
55
import type { CollationOptions } from '../operations/command';
66
import { CountOperation, type CountOptions } from '../operations/count';
@@ -77,7 +77,9 @@ export class FindCursor<TSchema = any> extends AbstractCursor<TSchema> {
7777

7878
const response = await executeOperation(this.client, findOperation);
7979

80-
this[kNumReturned] = response.cursor.firstBatch.length;
80+
if (!Explain.fromOptions(this[kBuiltOptions])) {
81+
this[kNumReturned] = response.cursor.firstBatch.length;
82+
}
8183

8284
// TODO: NODE-2882
8385
return { server: findOperation.server, session, response };

0 commit comments

Comments
 (0)