mongodb 6.18.0-dev.20250823.sha.c2166a50 → 6.18.0-dev.20250826.sha.66706f8e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/admin.js +2 -1
- package/lib/admin.js.map +1 -1
- package/lib/beta.d.ts +5 -5
- package/lib/collection.js.map +1 -1
- package/lib/cursor/run_command_cursor.js +2 -4
- package/lib/cursor/run_command_cursor.js.map +1 -1
- package/lib/db.js +1 -1
- package/lib/db.js.map +1 -1
- package/lib/mongo_client.js +25 -2
- package/lib/mongo_client.js.map +1 -1
- package/lib/operations/aggregate.js +1 -1
- package/lib/operations/aggregate.js.map +1 -1
- package/lib/operations/client_bulk_write/client_bulk_write.js +1 -1
- package/lib/operations/client_bulk_write/client_bulk_write.js.map +1 -1
- package/lib/operations/command.js +2 -67
- package/lib/operations/command.js.map +1 -1
- package/lib/operations/count.js +1 -1
- package/lib/operations/count.js.map +1 -1
- package/lib/operations/create_collection.js +1 -1
- package/lib/operations/create_collection.js.map +1 -1
- package/lib/operations/delete.js +1 -1
- package/lib/operations/delete.js.map +1 -1
- package/lib/operations/distinct.js +18 -26
- package/lib/operations/distinct.js.map +1 -1
- package/lib/operations/drop.js +2 -2
- package/lib/operations/drop.js.map +1 -1
- package/lib/operations/estimated_document_count.js +1 -1
- package/lib/operations/estimated_document_count.js.map +1 -1
- package/lib/operations/execute_operation.js +1 -5
- package/lib/operations/execute_operation.js.map +1 -1
- package/lib/operations/find.js +1 -1
- package/lib/operations/find.js.map +1 -1
- package/lib/operations/find_and_modify.js +1 -1
- package/lib/operations/find_and_modify.js.map +1 -1
- package/lib/operations/get_more.js +1 -1
- package/lib/operations/get_more.js.map +1 -1
- package/lib/operations/indexes.js +3 -3
- package/lib/operations/indexes.js.map +1 -1
- package/lib/operations/insert.js +1 -1
- package/lib/operations/insert.js.map +1 -1
- package/lib/operations/kill_cursors.js +1 -1
- package/lib/operations/kill_cursors.js.map +1 -1
- package/lib/operations/list_collections.js +1 -1
- package/lib/operations/list_collections.js.map +1 -1
- package/lib/operations/list_databases.js +1 -1
- package/lib/operations/list_databases.js.map +1 -1
- package/lib/operations/operation.js +2 -10
- package/lib/operations/operation.js.map +1 -1
- package/lib/operations/profiling_level.js +14 -4
- package/lib/operations/profiling_level.js.map +1 -1
- package/lib/operations/remove_user.js +6 -2
- package/lib/operations/remove_user.js.map +1 -1
- package/lib/operations/rename.js +1 -1
- package/lib/operations/rename.js.map +1 -1
- package/lib/operations/run_command.js +28 -32
- package/lib/operations/run_command.js.map +1 -1
- package/lib/operations/search_indexes/create.js +1 -1
- package/lib/operations/search_indexes/create.js.map +1 -1
- package/lib/operations/search_indexes/drop.js +1 -1
- package/lib/operations/search_indexes/drop.js.map +1 -1
- package/lib/operations/search_indexes/update.js +1 -1
- package/lib/operations/search_indexes/update.js.map +1 -1
- package/lib/operations/set_profiling_level.js +8 -4
- package/lib/operations/set_profiling_level.js.map +1 -1
- package/lib/operations/stats.js +4 -2
- package/lib/operations/stats.js.map +1 -1
- package/lib/operations/update.js +1 -1
- package/lib/operations/update.js.map +1 -1
- package/lib/operations/validate_collection.js +1 -1
- package/lib/operations/validate_collection.js.map +1 -1
- package/lib/sdam/server.js +2 -80
- package/lib/sdam/server.js.map +1 -1
- package/lib/sdam/topology.js +1 -1
- package/lib/sdam/topology.js.map +1 -1
- package/lib/sessions.js +3 -3
- package/lib/sessions.js.map +1 -1
- package/mongodb.d.ts +5 -5
- package/package.json +15 -15
- package/src/admin.ts +3 -2
- package/src/collection.ts +6 -0
- package/src/cursor/run_command_cursor.ts +4 -5
- package/src/db.ts +1 -1
- package/src/index.ts +1 -7
- package/src/mongo_client.ts +24 -9
- package/src/operations/aggregate.ts +2 -6
- package/src/operations/client_bulk_write/client_bulk_write.ts +2 -2
- package/src/operations/command.ts +2 -106
- package/src/operations/count.ts +2 -2
- package/src/operations/create_collection.ts +2 -2
- package/src/operations/delete.ts +2 -6
- package/src/operations/distinct.ts +23 -40
- package/src/operations/drop.ts +3 -3
- package/src/operations/estimated_document_count.ts +2 -2
- package/src/operations/execute_operation.ts +5 -14
- package/src/operations/find.ts +2 -6
- package/src/operations/find_and_modify.ts +2 -2
- package/src/operations/get_more.ts +2 -2
- package/src/operations/indexes.ts +4 -4
- package/src/operations/insert.ts +2 -2
- package/src/operations/kill_cursors.ts +2 -2
- package/src/operations/list_collections.ts +2 -2
- package/src/operations/list_databases.ts +2 -2
- package/src/operations/operation.ts +0 -19
- package/src/operations/profiling_level.ts +17 -11
- package/src/operations/remove_user.ts +9 -9
- package/src/operations/rename.ts +2 -2
- package/src/operations/run_command.ts +40 -68
- package/src/operations/search_indexes/create.ts +2 -2
- package/src/operations/search_indexes/drop.ts +2 -2
- package/src/operations/search_indexes/update.ts +2 -2
- package/src/operations/set_profiling_level.ts +13 -11
- package/src/operations/stats.ts +5 -10
- package/src/operations/update.ts +2 -6
- package/src/operations/validate_collection.ts +2 -2
- package/src/sdam/server.ts +4 -107
- package/src/sdam/topology.ts +1 -1
- package/src/sessions.ts +5 -4
|
@@ -5,7 +5,7 @@ import type { Collection } from '../../collection';
|
|
|
5
5
|
import type { ServerCommandOptions } from '../../sdam/server';
|
|
6
6
|
import type { ClientSession } from '../../sessions';
|
|
7
7
|
import { type TimeoutContext } from '../../timeout';
|
|
8
|
-
import {
|
|
8
|
+
import { AbstractOperation } from '../operation';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @public
|
|
@@ -22,7 +22,7 @@ export interface SearchIndexDescription extends Document {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/** @internal */
|
|
25
|
-
export class CreateSearchIndexesOperation extends
|
|
25
|
+
export class CreateSearchIndexesOperation extends AbstractOperation<Document> {
|
|
26
26
|
override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse;
|
|
27
27
|
private readonly collection: Collection;
|
|
28
28
|
private readonly descriptions: ReadonlyArray<SearchIndexDescription>;
|
|
@@ -6,10 +6,10 @@ import { MONGODB_ERROR_CODES, MongoServerError } from '../../error';
|
|
|
6
6
|
import type { ServerCommandOptions } from '../../sdam/server';
|
|
7
7
|
import type { ClientSession } from '../../sessions';
|
|
8
8
|
import { type TimeoutContext } from '../../timeout';
|
|
9
|
-
import {
|
|
9
|
+
import { AbstractOperation } from '../operation';
|
|
10
10
|
|
|
11
11
|
/** @internal */
|
|
12
|
-
export class DropSearchIndexOperation extends
|
|
12
|
+
export class DropSearchIndexOperation extends AbstractOperation<void> {
|
|
13
13
|
override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse;
|
|
14
14
|
|
|
15
15
|
private readonly collection: Collection;
|
|
@@ -5,10 +5,10 @@ import type { Collection } from '../../collection';
|
|
|
5
5
|
import type { ServerCommandOptions } from '../../sdam/server';
|
|
6
6
|
import type { ClientSession } from '../../sessions';
|
|
7
7
|
import { type TimeoutContext } from '../../timeout';
|
|
8
|
-
import {
|
|
8
|
+
import { AbstractOperation } from '../operation';
|
|
9
9
|
|
|
10
10
|
/** @internal */
|
|
11
|
-
export class UpdateSearchIndexOperation extends
|
|
11
|
+
export class UpdateSearchIndexOperation extends AbstractOperation<void> {
|
|
12
12
|
override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse;
|
|
13
13
|
private readonly collection: Collection;
|
|
14
14
|
private readonly name: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { type Document } from '../bson';
|
|
2
|
+
import { type Connection } from '../cmap/connection';
|
|
3
|
+
import { MongoDBResponse } from '../cmap/wire_protocol/responses';
|
|
1
4
|
import type { Db } from '../db';
|
|
2
5
|
import { MongoInvalidArgumentError } from '../error';
|
|
3
|
-
import type { Server } from '../sdam/server';
|
|
4
|
-
import type { ClientSession } from '../sessions';
|
|
5
|
-
import { type TimeoutContext } from '../timeout';
|
|
6
6
|
import { enumToString } from '../utils';
|
|
7
7
|
import { CommandOperation, type CommandOperationOptions } from './command';
|
|
8
8
|
|
|
@@ -23,6 +23,7 @@ export type SetProfilingLevelOptions = CommandOperationOptions;
|
|
|
23
23
|
|
|
24
24
|
/** @internal */
|
|
25
25
|
export class SetProfilingLevelOperation extends CommandOperation<ProfilingLevel> {
|
|
26
|
+
override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse;
|
|
26
27
|
override options: SetProfilingLevelOptions;
|
|
27
28
|
level: ProfilingLevel;
|
|
28
29
|
profile: 0 | 1 | 2;
|
|
@@ -52,21 +53,22 @@ export class SetProfilingLevelOperation extends CommandOperation<ProfilingLevel>
|
|
|
52
53
|
return 'profile' as const;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
override
|
|
56
|
-
server: Server,
|
|
57
|
-
session: ClientSession | undefined,
|
|
58
|
-
timeoutContext: TimeoutContext
|
|
59
|
-
): Promise<ProfilingLevel> {
|
|
56
|
+
override buildCommandDocument(_connection: Connection): Document {
|
|
60
57
|
const level = this.level;
|
|
61
58
|
|
|
62
59
|
if (!levelValues.has(level)) {
|
|
60
|
+
// TODO(NODE-3483): Determine error to put here
|
|
63
61
|
throw new MongoInvalidArgumentError(
|
|
64
62
|
`Profiling level must be one of "${enumToString(ProfilingLevel)}"`
|
|
65
63
|
);
|
|
66
64
|
}
|
|
67
65
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
return { profile: this.profile };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
override handleOk(
|
|
70
|
+
_response: InstanceType<typeof this.SERVER_COMMAND_RESPONSE_TYPE>
|
|
71
|
+
): ProfilingLevel {
|
|
72
|
+
return this.level;
|
|
71
73
|
}
|
|
72
74
|
}
|
package/src/operations/stats.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Document } from '../bson';
|
|
2
|
+
import { type Connection } from '../cmap/connection';
|
|
3
|
+
import { MongoDBResponse } from '../cmap/wire_protocol/responses';
|
|
2
4
|
import type { Db } from '../db';
|
|
3
|
-
import type { Server } from '../sdam/server';
|
|
4
|
-
import type { ClientSession } from '../sessions';
|
|
5
|
-
import { type TimeoutContext } from '../timeout';
|
|
6
5
|
import { CommandOperation, type CommandOperationOptions } from './command';
|
|
7
6
|
import { Aspect, defineAspects } from './operation';
|
|
8
7
|
|
|
@@ -14,6 +13,7 @@ export interface DbStatsOptions extends CommandOperationOptions {
|
|
|
14
13
|
|
|
15
14
|
/** @internal */
|
|
16
15
|
export class DbStatsOperation extends CommandOperation<Document> {
|
|
16
|
+
override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse;
|
|
17
17
|
override options: DbStatsOptions;
|
|
18
18
|
|
|
19
19
|
constructor(db: Db, options: DbStatsOptions) {
|
|
@@ -25,17 +25,12 @@ export class DbStatsOperation extends CommandOperation<Document> {
|
|
|
25
25
|
return 'dbStats' as const;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
override
|
|
29
|
-
server: Server,
|
|
30
|
-
session: ClientSession | undefined,
|
|
31
|
-
timeoutContext: TimeoutContext
|
|
32
|
-
): Promise<Document> {
|
|
28
|
+
override buildCommandDocument(_connection: Connection): Document {
|
|
33
29
|
const command: Document = { dbStats: true };
|
|
34
30
|
if (this.options.scale != null) {
|
|
35
31
|
command.scale = this.options.scale;
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
return await super.executeCommand(server, session, command, timeoutContext);
|
|
33
|
+
return command;
|
|
39
34
|
}
|
|
40
35
|
}
|
|
41
36
|
|
package/src/operations/update.ts
CHANGED
|
@@ -10,11 +10,7 @@ import {
|
|
|
10
10
|
type MongoDBCollectionNamespace,
|
|
11
11
|
type MongoDBNamespace
|
|
12
12
|
} from '../utils';
|
|
13
|
-
import {
|
|
14
|
-
type CollationOptions,
|
|
15
|
-
type CommandOperationOptions,
|
|
16
|
-
ModernizedCommandOperation
|
|
17
|
-
} from './command';
|
|
13
|
+
import { type CollationOptions, CommandOperation, type CommandOperationOptions } from './command';
|
|
18
14
|
import { Aspect, defineAspects, type Hint } from './operation';
|
|
19
15
|
|
|
20
16
|
/** @public */
|
|
@@ -74,7 +70,7 @@ export interface UpdateStatement {
|
|
|
74
70
|
* @internal
|
|
75
71
|
* UpdateOperation is used in bulk write, while UpdateOneOperation and UpdateManyOperation are only used in the collections API
|
|
76
72
|
*/
|
|
77
|
-
export class UpdateOperation extends
|
|
73
|
+
export class UpdateOperation extends CommandOperation<Document> {
|
|
78
74
|
override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse;
|
|
79
75
|
override options: UpdateOptions & { ordered?: boolean };
|
|
80
76
|
statements: UpdateStatement[];
|
|
@@ -4,7 +4,7 @@ import { type Document } from '../bson';
|
|
|
4
4
|
import { MongoDBResponse } from '../cmap/wire_protocol/responses';
|
|
5
5
|
import { MongoUnexpectedServerResponseError } from '../error';
|
|
6
6
|
import type { ClientSession } from '../sessions';
|
|
7
|
-
import { type CommandOperationOptions
|
|
7
|
+
import { CommandOperation, type CommandOperationOptions } from './command';
|
|
8
8
|
|
|
9
9
|
/** @public */
|
|
10
10
|
export interface ValidateCollectionOptions extends CommandOperationOptions {
|
|
@@ -13,7 +13,7 @@ export interface ValidateCollectionOptions extends CommandOperationOptions {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/** @internal */
|
|
16
|
-
export class ValidateCollectionOperation extends
|
|
16
|
+
export class ValidateCollectionOperation extends CommandOperation<Document> {
|
|
17
17
|
override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse;
|
|
18
18
|
override options: ValidateCollectionOptions;
|
|
19
19
|
collectionName: string;
|
package/src/sdam/server.ts
CHANGED
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
type ConnectionPoolOptions
|
|
8
8
|
} from '../cmap/connection_pool';
|
|
9
9
|
import { PoolClearedError } from '../cmap/errors';
|
|
10
|
-
import { type MongoDBResponseConstructor } from '../cmap/wire_protocol/responses';
|
|
11
10
|
import {
|
|
12
11
|
APM_EVENTS,
|
|
13
12
|
CLOSED,
|
|
@@ -27,7 +26,6 @@ import {
|
|
|
27
26
|
MONGODB_ERROR_CODES,
|
|
28
27
|
MongoError,
|
|
29
28
|
MongoErrorLabel,
|
|
30
|
-
MongoInvalidArgumentError,
|
|
31
29
|
MongoNetworkError,
|
|
32
30
|
MongoNetworkTimeoutError,
|
|
33
31
|
MongoRuntimeError,
|
|
@@ -39,7 +37,7 @@ import type { ServerApi } from '../mongo_client';
|
|
|
39
37
|
import { type Abortable, TypedEventEmitter } from '../mongo_types';
|
|
40
38
|
import { AggregateOperation } from '../operations/aggregate';
|
|
41
39
|
import type { GetMoreOptions } from '../operations/get_more';
|
|
42
|
-
import { type
|
|
40
|
+
import { type AbstractOperation } from '../operations/operation';
|
|
43
41
|
import type { ClientSession } from '../sessions';
|
|
44
42
|
import { type TimeoutContext } from '../timeout';
|
|
45
43
|
import { isTransactionCommand } from '../transactions';
|
|
@@ -48,7 +46,6 @@ import {
|
|
|
48
46
|
type EventEmitterWithState,
|
|
49
47
|
makeStateMachine,
|
|
50
48
|
maxWireVersion,
|
|
51
|
-
type MongoDBNamespace,
|
|
52
49
|
noop,
|
|
53
50
|
squashError,
|
|
54
51
|
supportsRetryableWrites
|
|
@@ -281,8 +278,8 @@ export class Server extends TypedEventEmitter<ServerEvents> {
|
|
|
281
278
|
}
|
|
282
279
|
}
|
|
283
280
|
|
|
284
|
-
public async
|
|
285
|
-
operation:
|
|
281
|
+
public async command<TResult>(
|
|
282
|
+
operation: AbstractOperation<TResult>,
|
|
286
283
|
timeoutContext: TimeoutContext
|
|
287
284
|
): Promise<InstanceType<typeof operation.SERVER_COMMAND_RESPONSE_TYPE>> {
|
|
288
285
|
if (this.s.state === STATE_CLOSING || this.s.state === STATE_CLOSED) {
|
|
@@ -295,7 +292,7 @@ export class Server extends TypedEventEmitter<ServerEvents> {
|
|
|
295
292
|
this.incrementOperationCount();
|
|
296
293
|
if (conn == null) {
|
|
297
294
|
try {
|
|
298
|
-
conn = await this.pool.checkOut({ timeoutContext });
|
|
295
|
+
conn = await this.pool.checkOut({ timeoutContext, signal: operation.options.signal });
|
|
299
296
|
} catch (checkoutError) {
|
|
300
297
|
this.decrementOperationCount();
|
|
301
298
|
if (!(checkoutError instanceof PoolClearedError)) this.handleError(checkoutError);
|
|
@@ -385,106 +382,6 @@ export class Server extends TypedEventEmitter<ServerEvents> {
|
|
|
385
382
|
}
|
|
386
383
|
}
|
|
387
384
|
|
|
388
|
-
public async command<T extends MongoDBResponseConstructor>(
|
|
389
|
-
ns: MongoDBNamespace,
|
|
390
|
-
command: Document,
|
|
391
|
-
options: ServerCommandOptions,
|
|
392
|
-
responseType: T | undefined
|
|
393
|
-
): Promise<typeof responseType extends undefined ? Document : InstanceType<T>>;
|
|
394
|
-
|
|
395
|
-
public async command(
|
|
396
|
-
ns: MongoDBNamespace,
|
|
397
|
-
command: Document,
|
|
398
|
-
options: ServerCommandOptions
|
|
399
|
-
): Promise<Document>;
|
|
400
|
-
|
|
401
|
-
public async command(
|
|
402
|
-
ns: MongoDBNamespace,
|
|
403
|
-
cmd: Document,
|
|
404
|
-
{ ...options }: ServerCommandOptions,
|
|
405
|
-
responseType?: MongoDBResponseConstructor
|
|
406
|
-
): Promise<Document> {
|
|
407
|
-
if (ns.db == null || typeof ns === 'string') {
|
|
408
|
-
throw new MongoInvalidArgumentError('Namespace must not be a string');
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
if (this.s.state === STATE_CLOSING || this.s.state === STATE_CLOSED) {
|
|
412
|
-
throw new MongoServerClosedError();
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
options.directConnection = this.topology.s.options.directConnection;
|
|
416
|
-
|
|
417
|
-
if (this.description.iscryptd) {
|
|
418
|
-
options.omitMaxTimeMS = true;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
const session = options.session;
|
|
422
|
-
let conn = session?.pinnedConnection;
|
|
423
|
-
|
|
424
|
-
this.incrementOperationCount();
|
|
425
|
-
if (conn == null) {
|
|
426
|
-
try {
|
|
427
|
-
conn = await this.pool.checkOut(options);
|
|
428
|
-
if (this.loadBalanced && isPinnableCommand(cmd, session)) {
|
|
429
|
-
session?.pin(conn);
|
|
430
|
-
}
|
|
431
|
-
} catch (checkoutError) {
|
|
432
|
-
this.decrementOperationCount();
|
|
433
|
-
if (!(checkoutError instanceof PoolClearedError)) this.handleError(checkoutError);
|
|
434
|
-
throw checkoutError;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
let reauthPromise: Promise<void> | null = null;
|
|
439
|
-
|
|
440
|
-
try {
|
|
441
|
-
try {
|
|
442
|
-
const res = await conn.command(ns, cmd, options, responseType);
|
|
443
|
-
throwIfWriteConcernError(res);
|
|
444
|
-
return res;
|
|
445
|
-
} catch (commandError) {
|
|
446
|
-
throw this.decorateCommandError(conn, cmd, options, commandError);
|
|
447
|
-
}
|
|
448
|
-
} catch (operationError) {
|
|
449
|
-
if (
|
|
450
|
-
operationError instanceof MongoError &&
|
|
451
|
-
operationError.code === MONGODB_ERROR_CODES.Reauthenticate
|
|
452
|
-
) {
|
|
453
|
-
reauthPromise = this.pool.reauthenticate(conn);
|
|
454
|
-
reauthPromise.then(undefined, error => {
|
|
455
|
-
reauthPromise = null;
|
|
456
|
-
squashError(error);
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
await abortable(reauthPromise, options);
|
|
460
|
-
reauthPromise = null; // only reachable if reauth succeeds
|
|
461
|
-
|
|
462
|
-
try {
|
|
463
|
-
const res = await conn.command(ns, cmd, options, responseType);
|
|
464
|
-
throwIfWriteConcernError(res);
|
|
465
|
-
return res;
|
|
466
|
-
} catch (commandError) {
|
|
467
|
-
throw this.decorateCommandError(conn, cmd, options, commandError);
|
|
468
|
-
}
|
|
469
|
-
} else {
|
|
470
|
-
throw operationError;
|
|
471
|
-
}
|
|
472
|
-
} finally {
|
|
473
|
-
this.decrementOperationCount();
|
|
474
|
-
if (session?.pinnedConnection !== conn) {
|
|
475
|
-
if (reauthPromise != null) {
|
|
476
|
-
// The reauth promise only exists if it hasn't thrown.
|
|
477
|
-
const checkBackIn = () => {
|
|
478
|
-
this.pool.checkIn(conn);
|
|
479
|
-
};
|
|
480
|
-
void reauthPromise.then(checkBackIn, checkBackIn);
|
|
481
|
-
} else {
|
|
482
|
-
this.pool.checkIn(conn);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
|
|
488
385
|
/**
|
|
489
386
|
* Handle SDAM error
|
|
490
387
|
* @internal
|
package/src/sdam/topology.ts
CHANGED
|
@@ -750,7 +750,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
|
|
|
750
750
|
}
|
|
751
751
|
|
|
752
752
|
auth(credentials?: MongoCredentials, callback?: Callback): void {
|
|
753
|
-
if (typeof credentials === 'function') (callback = credentials), (credentials = undefined);
|
|
753
|
+
if (typeof credentials === 'function') ((callback = credentials), (credentials = undefined));
|
|
754
754
|
if (typeof callback === 'function') callback(undefined, true);
|
|
755
755
|
}
|
|
756
756
|
|
package/src/sessions.ts
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import type { MongoClient, MongoOptions } from './mongo_client';
|
|
25
25
|
import { TypedEventEmitter } from './mongo_types';
|
|
26
26
|
import { executeOperation } from './operations/execute_operation';
|
|
27
|
-
import {
|
|
27
|
+
import { RunCommandOperation } from './operations/run_command';
|
|
28
28
|
import { ReadConcernLevel } from './read_concern';
|
|
29
29
|
import { ReadPreference } from './read_preference';
|
|
30
30
|
import { type AsyncDisposable, configureResourceManagement } from './resource_management';
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
isPromiseLike,
|
|
44
44
|
List,
|
|
45
45
|
maxWireVersion,
|
|
46
|
+
MongoDBNamespace,
|
|
46
47
|
noop,
|
|
47
48
|
now,
|
|
48
49
|
squashError,
|
|
@@ -505,7 +506,7 @@ export class ClientSession
|
|
|
505
506
|
command.recoveryToken = this.transaction.recoveryToken;
|
|
506
507
|
}
|
|
507
508
|
|
|
508
|
-
const operation = new
|
|
509
|
+
const operation = new RunCommandOperation(new MongoDBNamespace('admin'), command, {
|
|
509
510
|
session: this,
|
|
510
511
|
readPreference: ReadPreference.primary,
|
|
511
512
|
bypassPinningCheck: true
|
|
@@ -536,7 +537,7 @@ export class ClientSession
|
|
|
536
537
|
try {
|
|
537
538
|
await executeOperation(
|
|
538
539
|
this.client,
|
|
539
|
-
new
|
|
540
|
+
new RunCommandOperation(new MongoDBNamespace('admin'), command, {
|
|
540
541
|
session: this,
|
|
541
542
|
readPreference: ReadPreference.primary,
|
|
542
543
|
bypassPinningCheck: true
|
|
@@ -637,7 +638,7 @@ export class ClientSession
|
|
|
637
638
|
command.recoveryToken = this.transaction.recoveryToken;
|
|
638
639
|
}
|
|
639
640
|
|
|
640
|
-
const operation = new
|
|
641
|
+
const operation = new RunCommandOperation(new MongoDBNamespace('admin'), command, {
|
|
641
642
|
session: this,
|
|
642
643
|
readPreference: ReadPreference.primary,
|
|
643
644
|
bypassPinningCheck: true
|