Skip to content

Commit 66526ee

Browse files
remove pre-3.6 logic
1 parent 176377a commit 66526ee

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

src/cursor/find_cursor.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import { AbstractCursor, assertUninitialized } from './abstract_cursor';
1515
/** @internal */
1616
const kFilter = Symbol('filter');
1717
/** @internal */
18-
const kNumReturned = Symbol('numReturned');
19-
/** @internal */
2018
const kBuiltOptions = Symbol('builtOptions');
2119

2220
/** @public Flags allowed for cursor */
@@ -34,8 +32,6 @@ export class FindCursor<TSchema = any> extends AbstractCursor<TSchema> {
3432
/** @internal */
3533
[kFilter]: Document;
3634
/** @internal */
37-
[kNumReturned]?: number;
38-
/** @internal */
3935
[kBuiltOptions]: FindOptions;
4036

4137
/** @internal */
@@ -77,39 +73,13 @@ export class FindCursor<TSchema = any> extends AbstractCursor<TSchema> {
7773

7874
const response = await executeOperation(this.client, findOperation);
7975

80-
// TODO: We only need this for legacy queries that do not support `limit`, maybe
81-
// the value should only be saved in those cases.
82-
if (response.cursor) {
83-
this[kNumReturned] = response.cursor.firstBatch.length;
84-
} else {
85-
this[kNumReturned] = response.documents ? response.documents.length : 0;
86-
}
87-
8876
// TODO: NODE-2882
8977
return { server: findOperation.server, session, response };
9078
}
9179

9280
/** @internal */
9381
override async getMore(batchSize: number): Promise<Document | null> {
94-
// NOTE: this is to support client provided limits in pre-command servers
95-
const numReturned = this[kNumReturned];
96-
if (numReturned) {
97-
const limit = this[kBuiltOptions].limit;
98-
batchSize =
99-
limit && limit > 0 && numReturned + batchSize > limit ? limit - numReturned : batchSize;
100-
101-
if (batchSize <= 0) {
102-
await this.close().catch(() => null);
103-
return { cursor: { id: Long.ZERO, nextBatch: [] } };
104-
}
105-
}
106-
10782
const response = await super.getMore(batchSize);
108-
// TODO: wrap this in some logic to prevent it from happening if we don't need this support
109-
if (response) {
110-
this[kNumReturned] = this[kNumReturned] + response.cursor.nextBatch.length;
111-
}
112-
11383
return response;
11484
}
11585

0 commit comments

Comments
 (0)