mongodb 6.17.0 → 6.18.0
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/README.md +1 -3
- package/lib/beta.d.ts +68 -22
- package/lib/bulk/common.js.map +1 -1
- package/lib/change_stream.js.map +1 -1
- package/lib/client-side-encryption/auto_encrypter.js.map +1 -1
- package/lib/client-side-encryption/state_machine.js +1 -5
- package/lib/client-side-encryption/state_machine.js.map +1 -1
- package/lib/cmap/command_monitoring_events.js +2 -0
- package/lib/cmap/command_monitoring_events.js.map +1 -1
- package/lib/cmap/commands.js +10 -8
- package/lib/cmap/commands.js.map +1 -1
- package/lib/cmap/connection_pool.js +6 -2
- package/lib/cmap/connection_pool.js.map +1 -1
- package/lib/cmap/handshake/client_metadata.js +18 -1
- package/lib/cmap/handshake/client_metadata.js.map +1 -1
- package/lib/cmap/wire_protocol/compression.js.map +1 -1
- package/lib/cmap/wire_protocol/on_data.js +4 -0
- package/lib/cmap/wire_protocol/on_data.js.map +1 -1
- package/lib/cmap/wire_protocol/on_demand/document.js +16 -15
- package/lib/cmap/wire_protocol/on_demand/document.js.map +1 -1
- package/lib/cmap/wire_protocol/responses.js +11 -4
- package/lib/cmap/wire_protocol/responses.js.map +1 -1
- package/lib/connection_string.js +4 -5
- package/lib/connection_string.js.map +1 -1
- package/lib/cursor/abstract_cursor.js +45 -33
- package/lib/cursor/abstract_cursor.js.map +1 -1
- package/lib/cursor/run_command_cursor.js +3 -0
- package/lib/cursor/run_command_cursor.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/mongo_client.js +12 -0
- package/lib/mongo_client.js.map +1 -1
- package/lib/mongo_types.js +4 -1
- package/lib/mongo_types.js.map +1 -1
- package/lib/operations/command.js.map +1 -1
- package/lib/operations/distinct.js +1 -0
- package/lib/operations/distinct.js.map +1 -1
- package/lib/operations/rename.js.map +1 -1
- package/lib/operations/run_command.js.map +1 -1
- package/lib/operations/search_indexes/create.js.map +1 -1
- package/lib/operations/search_indexes/drop.js.map +1 -1
- package/lib/operations/search_indexes/update.js.map +1 -1
- package/lib/sessions.js.map +1 -1
- package/lib/transactions.js +9 -1
- package/lib/transactions.js.map +1 -1
- package/lib/utils.js +0 -1
- package/lib/utils.js.map +1 -1
- package/lib/write_concern.js +2 -4
- package/lib/write_concern.js.map +1 -1
- package/mongodb.d.ts +68 -22
- package/package.json +3 -3
- package/src/bulk/common.ts +3 -5
- package/src/change_stream.ts +38 -13
- package/src/client-side-encryption/auto_encrypter.ts +0 -1
- package/src/client-side-encryption/state_machine.ts +8 -10
- package/src/cmap/command_monitoring_events.ts +4 -0
- package/src/cmap/commands.ts +31 -16
- package/src/cmap/connection_pool.ts +6 -2
- package/src/cmap/handshake/client_metadata.ts +37 -4
- package/src/cmap/wire_protocol/compression.ts +2 -1
- package/src/cmap/wire_protocol/on_data.ts +5 -0
- package/src/cmap/wire_protocol/on_demand/document.ts +19 -14
- package/src/cmap/wire_protocol/responses.ts +8 -8
- package/src/connection_string.ts +5 -5
- package/src/cursor/abstract_cursor.ts +67 -44
- package/src/cursor/run_command_cursor.ts +7 -1
- package/src/index.ts +2 -0
- package/src/mongo_client.ts +48 -5
- package/src/mongo_types.ts +4 -1
- package/src/operations/command.ts +4 -0
- package/src/operations/distinct.ts +1 -0
- package/src/operations/rename.ts +8 -5
- package/src/operations/run_command.ts +17 -4
- package/src/operations/search_indexes/create.ts +6 -4
- package/src/operations/search_indexes/drop.ts +6 -4
- package/src/operations/search_indexes/update.ts +8 -5
- package/src/sessions.ts +1 -0
- package/src/transactions.ts +10 -1
- package/src/utils.ts +8 -8
- package/src/write_concern.ts +2 -4
- package/tsconfig.json +2 -1
package/mongodb.d.ts
CHANGED
|
@@ -1006,10 +1006,10 @@ export declare type BSONTypeAlias = keyof typeof BSONType;
|
|
|
1006
1006
|
|
|
1007
1007
|
/** @public */
|
|
1008
1008
|
export declare abstract class BulkOperationBase {
|
|
1009
|
-
private collection;
|
|
1010
1009
|
isOrdered: boolean;
|
|
1011
1010
|
/* Excluded from this release type: s */
|
|
1012
1011
|
operationId?: number;
|
|
1012
|
+
private collection;
|
|
1013
1013
|
/* Excluded from this release type: __constructor */
|
|
1014
1014
|
/**
|
|
1015
1015
|
* Add a single insert document to the bulk operation
|
|
@@ -1164,7 +1164,10 @@ export declare class BulkWriteResult {
|
|
|
1164
1164
|
*/
|
|
1165
1165
|
export declare type Callback<T = any> = (error?: AnyError, result?: T) => void;
|
|
1166
1166
|
|
|
1167
|
-
/**
|
|
1167
|
+
/**
|
|
1168
|
+
* @public
|
|
1169
|
+
* @deprecated Will be removed in favor of `AbortSignal` in the next major release.
|
|
1170
|
+
*/
|
|
1168
1171
|
export declare class CancellationToken extends TypedEventEmitter<{
|
|
1169
1172
|
cancel(): void;
|
|
1170
1173
|
}> {
|
|
@@ -1272,7 +1275,7 @@ export declare class ChangeStream<TSchema extends Document = Document, TChange e
|
|
|
1272
1275
|
* @public
|
|
1273
1276
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/modify/#mongodb-data-modify
|
|
1274
1277
|
*/
|
|
1275
|
-
export declare interface ChangeStreamCollModDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
|
|
1278
|
+
export declare interface ChangeStreamCollModDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
|
|
1276
1279
|
/** Describes the type of operation represented in this change notification */
|
|
1277
1280
|
operationType: 'modify';
|
|
1278
1281
|
}
|
|
@@ -1281,7 +1284,7 @@ export declare interface ChangeStreamCollModDocument extends ChangeStreamDocumen
|
|
|
1281
1284
|
* @public
|
|
1282
1285
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/create/#mongodb-data-create
|
|
1283
1286
|
*/
|
|
1284
|
-
export declare interface ChangeStreamCreateDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
|
|
1287
|
+
export declare interface ChangeStreamCreateDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
|
|
1285
1288
|
/** Describes the type of operation represented in this change notification */
|
|
1286
1289
|
operationType: 'create';
|
|
1287
1290
|
/**
|
|
@@ -1297,7 +1300,7 @@ export declare interface ChangeStreamCreateDocument extends ChangeStreamDocument
|
|
|
1297
1300
|
* @public
|
|
1298
1301
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/createIndexes/#mongodb-data-createIndexes
|
|
1299
1302
|
*/
|
|
1300
|
-
export declare interface ChangeStreamCreateIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
|
|
1303
|
+
export declare interface ChangeStreamCreateIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription, ChangeStreamDocumentWallTime {
|
|
1301
1304
|
/** Describes the type of operation represented in this change notification */
|
|
1302
1305
|
operationType: 'createIndexes';
|
|
1303
1306
|
}
|
|
@@ -1310,7 +1313,7 @@ export declare interface ChangeStreamCreateIndexDocument extends ChangeStreamDoc
|
|
|
1310
1313
|
* @public
|
|
1311
1314
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/#delete-event
|
|
1312
1315
|
*/
|
|
1313
|
-
export declare interface ChangeStreamDeleteDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID {
|
|
1316
|
+
export declare interface ChangeStreamDeleteDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
|
|
1314
1317
|
/** Describes the type of operation represented in this change notification */
|
|
1315
1318
|
operationType: 'delete';
|
|
1316
1319
|
/** Namespace the delete event occurred on */
|
|
@@ -1403,11 +1406,21 @@ export declare interface ChangeStreamDocumentOperationDescription {
|
|
|
1403
1406
|
operationDescription?: Document;
|
|
1404
1407
|
}
|
|
1405
1408
|
|
|
1409
|
+
/** @public */
|
|
1410
|
+
export declare interface ChangeStreamDocumentWallTime {
|
|
1411
|
+
/**
|
|
1412
|
+
* The server date and time of the database operation.
|
|
1413
|
+
* wallTime differs from clusterTime in that clusterTime is a timestamp taken from the oplog entry associated with the database operation event.
|
|
1414
|
+
* @sinceServerVersion 6.0.0
|
|
1415
|
+
*/
|
|
1416
|
+
wallTime?: Date;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1406
1419
|
/**
|
|
1407
1420
|
* @public
|
|
1408
1421
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/#dropdatabase-event
|
|
1409
1422
|
*/
|
|
1410
|
-
export declare interface ChangeStreamDropDatabaseDocument extends ChangeStreamDocumentCommon {
|
|
1423
|
+
export declare interface ChangeStreamDropDatabaseDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentWallTime {
|
|
1411
1424
|
/** Describes the type of operation represented in this change notification */
|
|
1412
1425
|
operationType: 'dropDatabase';
|
|
1413
1426
|
/** The database dropped */
|
|
@@ -1420,7 +1433,7 @@ export declare interface ChangeStreamDropDatabaseDocument extends ChangeStreamDo
|
|
|
1420
1433
|
* @public
|
|
1421
1434
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/#drop-event
|
|
1422
1435
|
*/
|
|
1423
|
-
export declare interface ChangeStreamDropDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
|
|
1436
|
+
export declare interface ChangeStreamDropDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
|
|
1424
1437
|
/** Describes the type of operation represented in this change notification */
|
|
1425
1438
|
operationType: 'drop';
|
|
1426
1439
|
/** Namespace the drop event occurred on */
|
|
@@ -1432,7 +1445,7 @@ export declare interface ChangeStreamDropDocument extends ChangeStreamDocumentCo
|
|
|
1432
1445
|
* @public
|
|
1433
1446
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/dropIndexes/#mongodb-data-dropIndexes
|
|
1434
1447
|
*/
|
|
1435
|
-
export declare interface ChangeStreamDropIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
|
|
1448
|
+
export declare interface ChangeStreamDropIndexDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription, ChangeStreamDocumentWallTime {
|
|
1436
1449
|
/** Describes the type of operation represented in this change notification */
|
|
1437
1450
|
operationType: 'dropIndexes';
|
|
1438
1451
|
}
|
|
@@ -1459,7 +1472,7 @@ export declare type ChangeStreamEvents<TSchema extends Document = Document, TCha
|
|
|
1459
1472
|
* @public
|
|
1460
1473
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/#insert-event
|
|
1461
1474
|
*/
|
|
1462
|
-
export declare interface ChangeStreamInsertDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID {
|
|
1475
|
+
export declare interface ChangeStreamInsertDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
|
|
1463
1476
|
/** Describes the type of operation represented in this change notification */
|
|
1464
1477
|
operationType: 'insert';
|
|
1465
1478
|
/** This key will contain the document being inserted */
|
|
@@ -1472,7 +1485,7 @@ export declare interface ChangeStreamInsertDocument<TSchema extends Document = D
|
|
|
1472
1485
|
* @public
|
|
1473
1486
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/#invalidate-event
|
|
1474
1487
|
*/
|
|
1475
|
-
export declare interface ChangeStreamInvalidateDocument extends ChangeStreamDocumentCommon {
|
|
1488
|
+
export declare interface ChangeStreamInvalidateDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentWallTime {
|
|
1476
1489
|
/** Describes the type of operation represented in this change notification */
|
|
1477
1490
|
operationType: 'invalidate';
|
|
1478
1491
|
}
|
|
@@ -1563,7 +1576,7 @@ export declare interface ChangeStreamRefineCollectionShardKeyDocument extends Ch
|
|
|
1563
1576
|
* @public
|
|
1564
1577
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/#rename-event
|
|
1565
1578
|
*/
|
|
1566
|
-
export declare interface ChangeStreamRenameDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID {
|
|
1579
|
+
export declare interface ChangeStreamRenameDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
|
|
1567
1580
|
/** Describes the type of operation represented in this change notification */
|
|
1568
1581
|
operationType: 'rename';
|
|
1569
1582
|
/** The new name for the `ns.coll` collection */
|
|
@@ -1579,7 +1592,7 @@ export declare interface ChangeStreamRenameDocument extends ChangeStreamDocument
|
|
|
1579
1592
|
* @public
|
|
1580
1593
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/#replace-event
|
|
1581
1594
|
*/
|
|
1582
|
-
export declare interface ChangeStreamReplaceDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema
|
|
1595
|
+
export declare interface ChangeStreamReplaceDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentWallTime {
|
|
1583
1596
|
/** Describes the type of operation represented in this change notification */
|
|
1584
1597
|
operationType: 'replace';
|
|
1585
1598
|
/** The fullDocument of a replace event represents the document after the insert of the replacement document */
|
|
@@ -1609,7 +1622,7 @@ export declare interface ChangeStreamReshardCollectionDocument extends ChangeStr
|
|
|
1609
1622
|
* @public
|
|
1610
1623
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/shardCollection/#mongodb-data-shardCollection
|
|
1611
1624
|
*/
|
|
1612
|
-
export declare interface ChangeStreamShardCollectionDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription {
|
|
1625
|
+
export declare interface ChangeStreamShardCollectionDocument extends ChangeStreamDocumentCommon, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentOperationDescription, ChangeStreamDocumentWallTime {
|
|
1613
1626
|
/** Describes the type of operation represented in this change notification */
|
|
1614
1627
|
operationType: 'shardCollection';
|
|
1615
1628
|
}
|
|
@@ -1626,7 +1639,7 @@ export declare interface ChangeStreamSplitEvent {
|
|
|
1626
1639
|
* @public
|
|
1627
1640
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/#update-event
|
|
1628
1641
|
*/
|
|
1629
|
-
export declare interface ChangeStreamUpdateDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID {
|
|
1642
|
+
export declare interface ChangeStreamUpdateDocument<TSchema extends Document = Document> extends ChangeStreamDocumentCommon, ChangeStreamDocumentKey<TSchema>, ChangeStreamDocumentCollectionUUID, ChangeStreamDocumentWallTime {
|
|
1630
1643
|
/** Describes the type of operation represented in this change notification */
|
|
1631
1644
|
operationType: 'update';
|
|
1632
1645
|
/**
|
|
@@ -2262,6 +2275,7 @@ export declare interface ClientInsertOneResult {
|
|
|
2262
2275
|
|
|
2263
2276
|
/**
|
|
2264
2277
|
* @public
|
|
2278
|
+
* @deprecated This interface will be made internal in the next major release.
|
|
2265
2279
|
* @see https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.md#hello-command
|
|
2266
2280
|
*/
|
|
2267
2281
|
export declare interface ClientMetadata {
|
|
@@ -2289,7 +2303,10 @@ export declare interface ClientMetadata {
|
|
|
2289
2303
|
};
|
|
2290
2304
|
}
|
|
2291
2305
|
|
|
2292
|
-
/**
|
|
2306
|
+
/**
|
|
2307
|
+
* @public
|
|
2308
|
+
* @deprecated This interface will be made internal in the next major release.
|
|
2309
|
+
*/
|
|
2293
2310
|
export declare interface ClientMetadataOptions {
|
|
2294
2311
|
driverInfo?: {
|
|
2295
2312
|
name?: string;
|
|
@@ -2338,6 +2355,7 @@ export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents
|
|
|
2338
2355
|
explicit: boolean;
|
|
2339
2356
|
/* Excluded from this release type: owner */
|
|
2340
2357
|
defaultTransactionOptions: TransactionOptions;
|
|
2358
|
+
/** @deprecated - Will be made internal in the next major release */
|
|
2341
2359
|
transaction: Transaction;
|
|
2342
2360
|
/* Excluded from this release type: commitAttempted */
|
|
2343
2361
|
readonly snapshotEnabled: boolean;
|
|
@@ -3294,6 +3312,7 @@ export declare class CommandFailedEvent {
|
|
|
3294
3312
|
commandName: string;
|
|
3295
3313
|
failure: Error;
|
|
3296
3314
|
serviceId?: ObjectId;
|
|
3315
|
+
databaseName: string;
|
|
3297
3316
|
/* Excluded from this release type: name */
|
|
3298
3317
|
/* Excluded from this release type: __constructor */
|
|
3299
3318
|
get hasServiceId(): boolean;
|
|
@@ -3324,6 +3343,10 @@ export declare interface CommandOperationOptions extends OperationOptions, Write
|
|
|
3324
3343
|
retryWrites?: boolean;
|
|
3325
3344
|
dbName?: string;
|
|
3326
3345
|
authdb?: string;
|
|
3346
|
+
/**
|
|
3347
|
+
* @deprecated
|
|
3348
|
+
* This option is deprecated and will be removed in an upcoming major version.
|
|
3349
|
+
*/
|
|
3327
3350
|
noResponse?: boolean;
|
|
3328
3351
|
}
|
|
3329
3352
|
|
|
@@ -3374,6 +3397,7 @@ export declare class CommandSucceededEvent {
|
|
|
3374
3397
|
commandName: string;
|
|
3375
3398
|
reply: unknown;
|
|
3376
3399
|
serviceId?: ObjectId;
|
|
3400
|
+
databaseName: string;
|
|
3377
3401
|
/* Excluded from this release type: name */
|
|
3378
3402
|
/* Excluded from this release type: __constructor */
|
|
3379
3403
|
get hasServiceId(): boolean;
|
|
@@ -5728,10 +5752,15 @@ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> im
|
|
|
5728
5752
|
/**
|
|
5729
5753
|
* The consolidate, parsed, transformed and merged options.
|
|
5730
5754
|
*/
|
|
5731
|
-
readonly options: Readonly<Omit<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert'>> & Pick<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert'>;
|
|
5755
|
+
readonly options: Readonly<Omit<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert' | 'driverInfo' | 'additionalDriverInfo' | 'metadata' | 'extendedMetadata'>> & Pick<MongoOptions, 'monitorCommands' | 'ca' | 'crl' | 'key' | 'cert' | 'driverInfo' | 'additionalDriverInfo' | 'metadata' | 'extendedMetadata'>;
|
|
5732
5756
|
constructor(url: string, options?: MongoClientOptions);
|
|
5733
5757
|
/* Excluded from this release type: [Symbol.asyncDispose] */
|
|
5734
5758
|
/* Excluded from this release type: asyncDispose */
|
|
5759
|
+
/**
|
|
5760
|
+
* Append metadata to the client metadata after instantiation.
|
|
5761
|
+
* @param driverInfo - Information about the application or library.
|
|
5762
|
+
*/
|
|
5763
|
+
appendMetadata(driverInfo: DriverInfo): void;
|
|
5735
5764
|
/* Excluded from this release type: checkForNonGenuineHosts */
|
|
5736
5765
|
get serverApi(): Readonly<ServerApi | undefined>;
|
|
5737
5766
|
/* Excluded from this release type: monitorCommands */
|
|
@@ -6088,7 +6117,11 @@ export declare interface MongoClientOptions extends BSONSerializeOptions, Suppor
|
|
|
6088
6117
|
minPoolSize?: number;
|
|
6089
6118
|
/** The maximum number of connections that may be in the process of being established concurrently by the connection pool. */
|
|
6090
6119
|
maxConnecting?: number;
|
|
6091
|
-
/**
|
|
6120
|
+
/**
|
|
6121
|
+
* The maximum amount of time a connection should remain idle in the connection pool before being marked idle, in milliseconds.
|
|
6122
|
+
* If specified, this must be a number greater than or equal to 0, where 0 means there is no limit. Defaults to 0. After this
|
|
6123
|
+
* time passes, the idle collection can be automatically cleaned up in the background.
|
|
6124
|
+
*/
|
|
6092
6125
|
maxIdleTimeMS?: number;
|
|
6093
6126
|
/** The maximum time in milliseconds that a thread can wait for a connection to become available. */
|
|
6094
6127
|
waitQueueTimeoutMS?: number;
|
|
@@ -6478,14 +6511,14 @@ export declare interface MongoDBLogWritable {
|
|
|
6478
6511
|
/** @public */
|
|
6479
6512
|
export declare class MongoDBNamespace {
|
|
6480
6513
|
db: string;
|
|
6481
|
-
collection?: string
|
|
6514
|
+
collection?: string;
|
|
6482
6515
|
/**
|
|
6483
6516
|
* Create a namespace object
|
|
6484
6517
|
*
|
|
6485
6518
|
* @param db - database name
|
|
6486
6519
|
* @param collection - collection name
|
|
6487
6520
|
*/
|
|
6488
|
-
constructor(db: string, collection?: string
|
|
6521
|
+
constructor(db: string, collection?: string);
|
|
6489
6522
|
toString(): string;
|
|
6490
6523
|
withCollection(collection: string): MongoDBCollectionNamespace;
|
|
6491
6524
|
static fromString(namespace?: string): MongoDBNamespace;
|
|
@@ -6970,8 +7003,10 @@ export declare interface MongoOptions extends Required<Pick<MongoClientOptions,
|
|
|
6970
7003
|
compressors: CompressorName[];
|
|
6971
7004
|
writeConcern: WriteConcern;
|
|
6972
7005
|
dbName: string;
|
|
7006
|
+
/** @deprecated - Will be made internal in a future major release. */
|
|
6973
7007
|
metadata: ClientMetadata;
|
|
6974
|
-
|
|
7008
|
+
extendedMetadata: Promise<Document>;
|
|
7009
|
+
additionalDriverInfo: DriverInfo[];
|
|
6975
7010
|
/* Excluded from this release type: autoEncrypter */
|
|
6976
7011
|
/* Excluded from this release type: tokenCache */
|
|
6977
7012
|
proxyHost?: string;
|
|
@@ -7457,6 +7492,8 @@ export declare type OnlyFieldsOfType<TSchema, FieldType = any, AssignableType =
|
|
|
7457
7492
|
|
|
7458
7493
|
/* Excluded from this release type: OpCompressedRequest */
|
|
7459
7494
|
|
|
7495
|
+
/* Excluded from this release type: OpCompressesRequestOptions */
|
|
7496
|
+
|
|
7460
7497
|
/** @public */
|
|
7461
7498
|
export declare interface OperationOptions extends BSONSerializeOptions {
|
|
7462
7499
|
/** Specify ClientSession for this command */
|
|
@@ -8598,23 +8635,32 @@ export declare interface TopologyVersion {
|
|
|
8598
8635
|
|
|
8599
8636
|
/**
|
|
8600
8637
|
* @public
|
|
8638
|
+
* @deprecated - Will be made internal in a future major release.
|
|
8601
8639
|
* A class maintaining state related to a server transaction. Internal Only
|
|
8602
8640
|
*/
|
|
8603
8641
|
export declare class Transaction {
|
|
8604
8642
|
/* Excluded from this release type: state */
|
|
8643
|
+
/** @deprecated - Will be made internal in a future major release. */
|
|
8605
8644
|
options: TransactionOptions;
|
|
8606
8645
|
/* Excluded from this release type: _pinnedServer */
|
|
8607
8646
|
/* Excluded from this release type: _recoveryToken */
|
|
8608
8647
|
/* Excluded from this release type: __constructor */
|
|
8609
8648
|
/* Excluded from this release type: server */
|
|
8649
|
+
/** @deprecated - Will be made internal in a future major release. */
|
|
8610
8650
|
get recoveryToken(): Document | undefined;
|
|
8651
|
+
/** @deprecated - Will be made internal in a future major release. */
|
|
8611
8652
|
get isPinned(): boolean;
|
|
8612
|
-
/**
|
|
8653
|
+
/**
|
|
8654
|
+
* @deprecated - Will be made internal in a future major release.
|
|
8655
|
+
* @returns Whether the transaction has started
|
|
8656
|
+
*/
|
|
8613
8657
|
get isStarting(): boolean;
|
|
8614
8658
|
/**
|
|
8659
|
+
* @deprecated - Will be made internal in a future major release.
|
|
8615
8660
|
* @returns Whether this session is presently in a transaction
|
|
8616
8661
|
*/
|
|
8617
8662
|
get isActive(): boolean;
|
|
8663
|
+
/** @deprecated - Will be made internal in a future major release. */
|
|
8618
8664
|
get isCommitted(): boolean;
|
|
8619
8665
|
/* Excluded from this release type: transition */
|
|
8620
8666
|
/* Excluded from this release type: pinServer */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongodb",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.18.0",
|
|
4
4
|
"description": "The official MongoDB driver for Node.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
"socks": "^2.8.1",
|
|
108
108
|
"source-map-support": "^0.5.21",
|
|
109
109
|
"ts-node": "^10.9.2",
|
|
110
|
-
"tsd": "^0.
|
|
111
|
-
"typescript": "5.
|
|
110
|
+
"tsd": "^0.32.0",
|
|
111
|
+
"typescript": "5.8.3",
|
|
112
112
|
"typescript-cached-transpile": "^0.0.6",
|
|
113
113
|
"v8-heapsnapshot": "^1.3.1",
|
|
114
114
|
"yargs": "^17.7.2"
|
package/src/bulk/common.ts
CHANGED
|
@@ -894,16 +894,14 @@ export abstract class BulkOperationBase {
|
|
|
894
894
|
/** @internal */
|
|
895
895
|
s: BulkOperationPrivate;
|
|
896
896
|
operationId?: number;
|
|
897
|
+
private collection: Collection;
|
|
897
898
|
|
|
898
899
|
/**
|
|
899
900
|
* Create a new OrderedBulkOperation or UnorderedBulkOperation instance
|
|
900
901
|
* @internal
|
|
901
902
|
*/
|
|
902
|
-
constructor(
|
|
903
|
-
|
|
904
|
-
options: BulkWriteOptions,
|
|
905
|
-
isOrdered: boolean
|
|
906
|
-
) {
|
|
903
|
+
constructor(collection: Collection, options: BulkWriteOptions, isOrdered: boolean) {
|
|
904
|
+
this.collection = collection;
|
|
907
905
|
// determine whether bulkOperation is ordered or unordered
|
|
908
906
|
this.isOrdered = isOrdered;
|
|
909
907
|
|
package/src/change_stream.ts
CHANGED
|
@@ -205,6 +205,16 @@ export interface ChangeStreamDocumentCommon {
|
|
|
205
205
|
splitEvent?: ChangeStreamSplitEvent;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
/** @public */
|
|
209
|
+
export interface ChangeStreamDocumentWallTime {
|
|
210
|
+
/**
|
|
211
|
+
* The server date and time of the database operation.
|
|
212
|
+
* wallTime differs from clusterTime in that clusterTime is a timestamp taken from the oplog entry associated with the database operation event.
|
|
213
|
+
* @sinceServerVersion 6.0.0
|
|
214
|
+
*/
|
|
215
|
+
wallTime?: Date;
|
|
216
|
+
}
|
|
217
|
+
|
|
208
218
|
/** @public */
|
|
209
219
|
export interface ChangeStreamDocumentCollectionUUID {
|
|
210
220
|
/**
|
|
@@ -239,7 +249,8 @@ export interface ChangeStreamDocumentOperationDescription {
|
|
|
239
249
|
export interface ChangeStreamInsertDocument<TSchema extends Document = Document>
|
|
240
250
|
extends ChangeStreamDocumentCommon,
|
|
241
251
|
ChangeStreamDocumentKey<TSchema>,
|
|
242
|
-
ChangeStreamDocumentCollectionUUID
|
|
252
|
+
ChangeStreamDocumentCollectionUUID,
|
|
253
|
+
ChangeStreamDocumentWallTime {
|
|
243
254
|
/** Describes the type of operation represented in this change notification */
|
|
244
255
|
operationType: 'insert';
|
|
245
256
|
/** This key will contain the document being inserted */
|
|
@@ -255,7 +266,8 @@ export interface ChangeStreamInsertDocument<TSchema extends Document = Document>
|
|
|
255
266
|
export interface ChangeStreamUpdateDocument<TSchema extends Document = Document>
|
|
256
267
|
extends ChangeStreamDocumentCommon,
|
|
257
268
|
ChangeStreamDocumentKey<TSchema>,
|
|
258
|
-
ChangeStreamDocumentCollectionUUID
|
|
269
|
+
ChangeStreamDocumentCollectionUUID,
|
|
270
|
+
ChangeStreamDocumentWallTime {
|
|
259
271
|
/** Describes the type of operation represented in this change notification */
|
|
260
272
|
operationType: 'update';
|
|
261
273
|
/**
|
|
@@ -285,7 +297,8 @@ export interface ChangeStreamUpdateDocument<TSchema extends Document = Document>
|
|
|
285
297
|
*/
|
|
286
298
|
export interface ChangeStreamReplaceDocument<TSchema extends Document = Document>
|
|
287
299
|
extends ChangeStreamDocumentCommon,
|
|
288
|
-
ChangeStreamDocumentKey<TSchema
|
|
300
|
+
ChangeStreamDocumentKey<TSchema>,
|
|
301
|
+
ChangeStreamDocumentWallTime {
|
|
289
302
|
/** Describes the type of operation represented in this change notification */
|
|
290
303
|
operationType: 'replace';
|
|
291
304
|
/** The fullDocument of a replace event represents the document after the insert of the replacement document */
|
|
@@ -309,7 +322,8 @@ export interface ChangeStreamReplaceDocument<TSchema extends Document = Document
|
|
|
309
322
|
export interface ChangeStreamDeleteDocument<TSchema extends Document = Document>
|
|
310
323
|
extends ChangeStreamDocumentCommon,
|
|
311
324
|
ChangeStreamDocumentKey<TSchema>,
|
|
312
|
-
ChangeStreamDocumentCollectionUUID
|
|
325
|
+
ChangeStreamDocumentCollectionUUID,
|
|
326
|
+
ChangeStreamDocumentWallTime {
|
|
313
327
|
/** Describes the type of operation represented in this change notification */
|
|
314
328
|
operationType: 'delete';
|
|
315
329
|
/** Namespace the delete event occurred on */
|
|
@@ -330,7 +344,8 @@ export interface ChangeStreamDeleteDocument<TSchema extends Document = Document>
|
|
|
330
344
|
*/
|
|
331
345
|
export interface ChangeStreamDropDocument
|
|
332
346
|
extends ChangeStreamDocumentCommon,
|
|
333
|
-
ChangeStreamDocumentCollectionUUID
|
|
347
|
+
ChangeStreamDocumentCollectionUUID,
|
|
348
|
+
ChangeStreamDocumentWallTime {
|
|
334
349
|
/** Describes the type of operation represented in this change notification */
|
|
335
350
|
operationType: 'drop';
|
|
336
351
|
/** Namespace the drop event occurred on */
|
|
@@ -343,7 +358,8 @@ export interface ChangeStreamDropDocument
|
|
|
343
358
|
*/
|
|
344
359
|
export interface ChangeStreamRenameDocument
|
|
345
360
|
extends ChangeStreamDocumentCommon,
|
|
346
|
-
ChangeStreamDocumentCollectionUUID
|
|
361
|
+
ChangeStreamDocumentCollectionUUID,
|
|
362
|
+
ChangeStreamDocumentWallTime {
|
|
347
363
|
/** Describes the type of operation represented in this change notification */
|
|
348
364
|
operationType: 'rename';
|
|
349
365
|
/** The new name for the `ns.coll` collection */
|
|
@@ -356,7 +372,9 @@ export interface ChangeStreamRenameDocument
|
|
|
356
372
|
* @public
|
|
357
373
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/#dropdatabase-event
|
|
358
374
|
*/
|
|
359
|
-
export interface ChangeStreamDropDatabaseDocument
|
|
375
|
+
export interface ChangeStreamDropDatabaseDocument
|
|
376
|
+
extends ChangeStreamDocumentCommon,
|
|
377
|
+
ChangeStreamDocumentWallTime {
|
|
360
378
|
/** Describes the type of operation represented in this change notification */
|
|
361
379
|
operationType: 'dropDatabase';
|
|
362
380
|
/** The database dropped */
|
|
@@ -367,7 +385,9 @@ export interface ChangeStreamDropDatabaseDocument extends ChangeStreamDocumentCo
|
|
|
367
385
|
* @public
|
|
368
386
|
* @see https://www.mongodb.com/docs/manual/reference/change-events/#invalidate-event
|
|
369
387
|
*/
|
|
370
|
-
export interface ChangeStreamInvalidateDocument
|
|
388
|
+
export interface ChangeStreamInvalidateDocument
|
|
389
|
+
extends ChangeStreamDocumentCommon,
|
|
390
|
+
ChangeStreamDocumentWallTime {
|
|
371
391
|
/** Describes the type of operation represented in this change notification */
|
|
372
392
|
operationType: 'invalidate';
|
|
373
393
|
}
|
|
@@ -380,7 +400,8 @@ export interface ChangeStreamInvalidateDocument extends ChangeStreamDocumentComm
|
|
|
380
400
|
export interface ChangeStreamCreateIndexDocument
|
|
381
401
|
extends ChangeStreamDocumentCommon,
|
|
382
402
|
ChangeStreamDocumentCollectionUUID,
|
|
383
|
-
ChangeStreamDocumentOperationDescription
|
|
403
|
+
ChangeStreamDocumentOperationDescription,
|
|
404
|
+
ChangeStreamDocumentWallTime {
|
|
384
405
|
/** Describes the type of operation represented in this change notification */
|
|
385
406
|
operationType: 'createIndexes';
|
|
386
407
|
}
|
|
@@ -393,7 +414,8 @@ export interface ChangeStreamCreateIndexDocument
|
|
|
393
414
|
export interface ChangeStreamDropIndexDocument
|
|
394
415
|
extends ChangeStreamDocumentCommon,
|
|
395
416
|
ChangeStreamDocumentCollectionUUID,
|
|
396
|
-
ChangeStreamDocumentOperationDescription
|
|
417
|
+
ChangeStreamDocumentOperationDescription,
|
|
418
|
+
ChangeStreamDocumentWallTime {
|
|
397
419
|
/** Describes the type of operation represented in this change notification */
|
|
398
420
|
operationType: 'dropIndexes';
|
|
399
421
|
}
|
|
@@ -405,7 +427,8 @@ export interface ChangeStreamDropIndexDocument
|
|
|
405
427
|
*/
|
|
406
428
|
export interface ChangeStreamCollModDocument
|
|
407
429
|
extends ChangeStreamDocumentCommon,
|
|
408
|
-
ChangeStreamDocumentCollectionUUID
|
|
430
|
+
ChangeStreamDocumentCollectionUUID,
|
|
431
|
+
ChangeStreamDocumentWallTime {
|
|
409
432
|
/** Describes the type of operation represented in this change notification */
|
|
410
433
|
operationType: 'modify';
|
|
411
434
|
}
|
|
@@ -416,7 +439,8 @@ export interface ChangeStreamCollModDocument
|
|
|
416
439
|
*/
|
|
417
440
|
export interface ChangeStreamCreateDocument
|
|
418
441
|
extends ChangeStreamDocumentCommon,
|
|
419
|
-
ChangeStreamDocumentCollectionUUID
|
|
442
|
+
ChangeStreamDocumentCollectionUUID,
|
|
443
|
+
ChangeStreamDocumentWallTime {
|
|
420
444
|
/** Describes the type of operation represented in this change notification */
|
|
421
445
|
operationType: 'create';
|
|
422
446
|
|
|
@@ -435,7 +459,8 @@ export interface ChangeStreamCreateDocument
|
|
|
435
459
|
export interface ChangeStreamShardCollectionDocument
|
|
436
460
|
extends ChangeStreamDocumentCommon,
|
|
437
461
|
ChangeStreamDocumentCollectionUUID,
|
|
438
|
-
ChangeStreamDocumentOperationDescription
|
|
462
|
+
ChangeStreamDocumentOperationDescription,
|
|
463
|
+
ChangeStreamDocumentWallTime {
|
|
439
464
|
/** Describes the type of operation represented in this change notification */
|
|
440
465
|
operationType: 'shardCollection';
|
|
441
466
|
}
|
|
@@ -68,12 +68,7 @@ const stateToString = new Map([
|
|
|
68
68
|
const INSECURE_TLS_OPTIONS = [
|
|
69
69
|
'tlsInsecure',
|
|
70
70
|
'tlsAllowInvalidCertificates',
|
|
71
|
-
'tlsAllowInvalidHostnames'
|
|
72
|
-
|
|
73
|
-
// These options are disallowed by the spec, so we explicitly filter them out if provided, even
|
|
74
|
-
// though the StateMachine does not declare support for these options.
|
|
75
|
-
'tlsDisableOCSPEndpointCheck',
|
|
76
|
-
'tlsDisableCertificateRevocationCheck'
|
|
71
|
+
'tlsAllowInvalidHostnames'
|
|
77
72
|
];
|
|
78
73
|
|
|
79
74
|
/**
|
|
@@ -186,10 +181,13 @@ export type StateMachineOptions = {
|
|
|
186
181
|
*/
|
|
187
182
|
// TODO(DRIVERS-2671): clarify CSOT behavior for FLE APIs
|
|
188
183
|
export class StateMachine {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
) {
|
|
184
|
+
private options: StateMachineOptions;
|
|
185
|
+
private bsonOptions: BSONSerializeOptions;
|
|
186
|
+
|
|
187
|
+
constructor(options: StateMachineOptions, bsonOptions = pluckBSONSerializeOptions(options)) {
|
|
188
|
+
this.options = options;
|
|
189
|
+
this.bsonOptions = bsonOptions;
|
|
190
|
+
}
|
|
193
191
|
|
|
194
192
|
/**
|
|
195
193
|
* Executes the state machine according to the specification
|
|
@@ -96,6 +96,7 @@ export class CommandSucceededEvent {
|
|
|
96
96
|
commandName: string;
|
|
97
97
|
reply: unknown;
|
|
98
98
|
serviceId?: ObjectId;
|
|
99
|
+
databaseName: string;
|
|
99
100
|
/** @internal */
|
|
100
101
|
name = COMMAND_SUCCEEDED;
|
|
101
102
|
|
|
@@ -127,6 +128,7 @@ export class CommandSucceededEvent {
|
|
|
127
128
|
this.duration = calculateDurationInMs(started);
|
|
128
129
|
this.reply = maybeRedact(commandName, cmd, extractReply(reply));
|
|
129
130
|
this.serverConnectionId = serverConnectionId;
|
|
131
|
+
this.databaseName = command.databaseName;
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
/* @internal */
|
|
@@ -154,6 +156,7 @@ export class CommandFailedEvent {
|
|
|
154
156
|
commandName: string;
|
|
155
157
|
failure: Error;
|
|
156
158
|
serviceId?: ObjectId;
|
|
159
|
+
databaseName: string;
|
|
157
160
|
/** @internal */
|
|
158
161
|
name = COMMAND_FAILED;
|
|
159
162
|
|
|
@@ -186,6 +189,7 @@ export class CommandFailedEvent {
|
|
|
186
189
|
this.duration = calculateDurationInMs(started);
|
|
187
190
|
this.failure = maybeRedact(commandName, cmd, error) as Error;
|
|
188
191
|
this.serverConnectionId = serverConnectionId;
|
|
192
|
+
this.databaseName = command.databaseName;
|
|
189
193
|
}
|
|
190
194
|
|
|
191
195
|
/* @internal */
|
package/src/cmap/commands.ts
CHANGED
|
@@ -76,12 +76,10 @@ export class OpQueryRequest {
|
|
|
76
76
|
partial: boolean;
|
|
77
77
|
/** moreToCome is an OP_MSG only concept */
|
|
78
78
|
moreToCome = false;
|
|
79
|
+
databaseName: string;
|
|
80
|
+
query: Document;
|
|
79
81
|
|
|
80
|
-
constructor(
|
|
81
|
-
public databaseName: string,
|
|
82
|
-
public query: Document,
|
|
83
|
-
options: OpQueryOptions
|
|
84
|
-
) {
|
|
82
|
+
constructor(databaseName: string, query: Document, options: OpQueryOptions) {
|
|
85
83
|
// Basic options needed to be passed in
|
|
86
84
|
// TODO(NODE-3483): Replace with MongoCommandError
|
|
87
85
|
const ns = `${databaseName}.$cmd`;
|
|
@@ -97,7 +95,9 @@ export class OpQueryRequest {
|
|
|
97
95
|
throw new MongoRuntimeError('Namespace cannot contain a null character');
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
// Basic
|
|
98
|
+
// Basic optionsa
|
|
99
|
+
this.databaseName = databaseName;
|
|
100
|
+
this.query = query;
|
|
101
101
|
this.ns = ns;
|
|
102
102
|
|
|
103
103
|
// Additional options
|
|
@@ -496,17 +496,18 @@ export class OpMsgRequest {
|
|
|
496
496
|
checksumPresent: boolean;
|
|
497
497
|
moreToCome: boolean;
|
|
498
498
|
exhaustAllowed: boolean;
|
|
499
|
+
databaseName: string;
|
|
500
|
+
command: Document;
|
|
501
|
+
options: OpQueryOptions;
|
|
499
502
|
|
|
500
|
-
constructor(
|
|
501
|
-
public databaseName: string,
|
|
502
|
-
public command: Document,
|
|
503
|
-
public options: OpQueryOptions
|
|
504
|
-
) {
|
|
503
|
+
constructor(databaseName: string, command: Document, options: OpQueryOptions) {
|
|
505
504
|
// Basic options needed to be passed in
|
|
506
505
|
if (command == null)
|
|
507
506
|
throw new MongoInvalidArgumentError('Query document must be specified for query');
|
|
508
507
|
|
|
509
|
-
// Basic
|
|
508
|
+
// Basic optionsa
|
|
509
|
+
this.databaseName = databaseName;
|
|
510
|
+
this.command = command;
|
|
510
511
|
this.command.$db = databaseName;
|
|
511
512
|
|
|
512
513
|
// Ensure empty options
|
|
@@ -724,16 +725,30 @@ export class OpMsgResponse {
|
|
|
724
725
|
const MESSAGE_HEADER_SIZE = 16;
|
|
725
726
|
const COMPRESSION_DETAILS_SIZE = 9; // originalOpcode + uncompressedSize, compressorID
|
|
726
727
|
|
|
728
|
+
/**
|
|
729
|
+
* @internal
|
|
730
|
+
*/
|
|
731
|
+
export interface OpCompressesRequestOptions {
|
|
732
|
+
zlibCompressionLevel: number;
|
|
733
|
+
agreedCompressor: CompressorName;
|
|
734
|
+
}
|
|
735
|
+
|
|
727
736
|
/**
|
|
728
737
|
* @internal
|
|
729
738
|
*
|
|
730
739
|
* An OP_COMPRESSED request wraps either an OP_QUERY or OP_MSG message.
|
|
731
740
|
*/
|
|
732
741
|
export class OpCompressedRequest {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
) {
|
|
742
|
+
private command: WriteProtocolMessageType;
|
|
743
|
+
private options: OpCompressesRequestOptions;
|
|
744
|
+
|
|
745
|
+
constructor(command: WriteProtocolMessageType, options: OpCompressesRequestOptions) {
|
|
746
|
+
this.command = command;
|
|
747
|
+
this.options = {
|
|
748
|
+
zlibCompressionLevel: options.zlibCompressionLevel,
|
|
749
|
+
agreedCompressor: options.agreedCompressor
|
|
750
|
+
};
|
|
751
|
+
}
|
|
737
752
|
|
|
738
753
|
// Return whether a command contains an uncompressible command term
|
|
739
754
|
// Will return true if command contains no uncompressible command terms
|