Skip to content

Commit 55ecdc6

Browse files
committed
more cleaning
1 parent 60675de commit 55ecdc6

File tree

5 files changed

+24
-37
lines changed

5 files changed

+24
-37
lines changed

src/operations/get_more.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface GetMoreOptions extends OperationOptions {
2626
* @internal
2727
*/
2828
export interface GetMoreCommand {
29-
getMore: Long | bigint;
29+
getMore: Long;
3030
collection: string;
3131
batchSize?: number;
3232
maxTimeMS?: number;
@@ -36,15 +36,10 @@ export interface GetMoreCommand {
3636

3737
/** @internal */
3838
export class GetMoreOperation extends AbstractOperation {
39-
cursorId: Long | bigint;
39+
cursorId: Long;
4040
override options: GetMoreOptions;
4141

42-
constructor(
43-
ns: MongoDBNamespace,
44-
cursorId: Long | bigint,
45-
server: Server,
46-
options: GetMoreOptions
47-
) {
42+
constructor(ns: MongoDBNamespace, cursorId: Long, server: Server, options: GetMoreOptions) {
4843
super(options);
4944

5045
this.options = options;
@@ -68,11 +63,7 @@ export class GetMoreOperation extends AbstractOperation {
6863
);
6964
}
7065

71-
if (
72-
this.cursorId == null ||
73-
this.cursorId === 0n ||
74-
(typeof this.cursorId === 'object' && this.cursorId.isZero())
75-
) {
66+
if (this.cursorId == null || this.cursorId.isZero()) {
7667
return callback(new MongoRuntimeError('Unable to iterate cursor with no id'));
7768
}
7869

src/operations/kill_cursors.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,14 @@ import { AbstractOperation, Aspect, defineAspects, OperationOptions } from './op
1111
*/
1212
interface KillCursorsCommand {
1313
killCursors: string;
14-
cursors: (Long | bigint)[];
14+
cursors: Long[];
1515
comment?: unknown;
1616
}
1717

1818
export class KillCursorsOperation extends AbstractOperation {
19-
cursorId: Long | bigint;
20-
21-
constructor(
22-
cursorId: Long | bigint,
23-
ns: MongoDBNamespace,
24-
server: Server,
25-
options: OperationOptions
26-
) {
19+
cursorId: Long;
20+
21+
constructor(cursorId: Long, ns: MongoDBNamespace, server: Server, options: OperationOptions) {
2722
super(options);
2823
this.ns = ns;
2924
this.cursorId = cursorId;

src/sessions.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { ConnectionPoolMetrics } from './cmap/metrics';
66
import { isSharded } from './cmap/wire_protocol/shared';
77
import { PINNED, UNPINNED } from './constants';
88
import type { AbstractCursor } from './cursor/abstract_cursor';
9-
import type { RunCommandCursor } from './cursor/run_command_cursor';
109
import {
1110
AnyError,
1211
MongoAPIError,
@@ -54,7 +53,7 @@ export interface ClientSessionOptions {
5453
defaultTransactionOptions?: TransactionOptions;
5554

5655
/** @internal */
57-
owner?: symbol | AbstractCursor | RunCommandCursor;
56+
owner?: symbol | AbstractCursor;
5857
/** @internal */
5958
explicit?: boolean;
6059
/** @internal */
@@ -109,7 +108,7 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
109108
operationTime?: Timestamp;
110109
explicit: boolean;
111110
/** @internal */
112-
owner?: symbol | AbstractCursor | RunCommandCursor;
111+
owner?: symbol | AbstractCursor;
113112
defaultTransactionOptions: TransactionOptions;
114113
transaction: Transaction;
115114
/** @internal */

test/integration/node-specific/examples/run_command.test.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,21 @@ describe('examples.runCommand:', function () {
2424
db = undefined;
2525
});
2626

27-
it('supports runCommand 1', async function () {
28-
// Start runCommand example 1
29-
await db.command({ buildInfo: 1 });
30-
// End runCommand example 1
27+
it('supports runCommand 1', {
28+
metadata: { requires: { topology: ['single'] } },
29+
test: async function () {
30+
// Start runCommand example 1
31+
await db.command({ buildInfo: 1 });
32+
// End runCommand example 1
33+
}
3134
});
3235

33-
it('supports runCommand 2', async function () {
34-
// Start runCommand example 2
35-
await db.command({ collStats: 'restaurants' });
36-
// End runCommand example 2
36+
it('supports runCommand 2', {
37+
metadata: { requires: { topology: ['single'] } },
38+
test: async function () {
39+
// Start runCommand example 2
40+
await db.command({ collStats: 'restaurants' });
41+
// End runCommand example 2
42+
}
3743
});
3844
});

test/tools/unified-spec-runner/entities.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
MongoCredentials,
3131
ReadConcern,
3232
ReadPreference,
33-
RunCommandCursor,
3433
SENSITIVE_COMMANDS,
3534
ServerDescriptionChangedEvent,
3635
TopologyDescription,
@@ -442,9 +441,6 @@ export class EntitiesMap<E = Entity> extends Map<string, E> {
442441
throw new Error(`Unknown type ${type}`);
443442
}
444443
if (!(entity instanceof ctor)) {
445-
if (type === 'cursor' && entity instanceof RunCommandCursor) {
446-
return entity;
447-
}
448444
throw new Error(`${key} is not an instance of ${type}`);
449445
}
450446
return entity;

0 commit comments

Comments
 (0)