mongodb 6.9.0 → 6.10.0-dev.20241022.sha.678e9322
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/beta.d.ts +407 -12
- package/lib/bson.js +1 -0
- package/lib/bson.js.map +1 -1
- package/lib/bulk/common.js +60 -71
- package/lib/bulk/common.js.map +1 -1
- package/lib/bulk/unordered.js +3 -3
- package/lib/bulk/unordered.js.map +1 -1
- package/lib/change_stream.js +3 -2
- package/lib/change_stream.js.map +1 -1
- package/lib/cmap/auth/mongo_credentials.js +2 -7
- package/lib/cmap/auth/mongo_credentials.js.map +1 -1
- package/lib/cmap/auth/mongodb_oidc/callback_workflow.js.map +1 -1
- package/lib/cmap/auth/mongodb_oidc/command_builders.js +1 -1
- package/lib/cmap/auth/mongodb_oidc/command_builders.js.map +1 -1
- package/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js +1 -1
- package/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js.map +1 -1
- package/lib/cmap/auth/mongodb_oidc/machine_workflow.js.map +1 -1
- package/lib/cmap/auth/mongodb_oidc.js.map +1 -1
- package/lib/cmap/command_monitoring_events.js +10 -1
- package/lib/cmap/command_monitoring_events.js.map +1 -1
- package/lib/cmap/commands.js +50 -18
- package/lib/cmap/commands.js.map +1 -1
- package/lib/cmap/connection.js +9 -2
- package/lib/cmap/connection.js.map +1 -1
- package/lib/cmap/wire_protocol/constants.js +2 -2
- package/lib/cmap/wire_protocol/on_demand/document.js.map +1 -1
- package/lib/cmap/wire_protocol/responses.js +26 -1
- package/lib/cmap/wire_protocol/responses.js.map +1 -1
- package/lib/connection_string.js +1 -7
- package/lib/connection_string.js.map +1 -1
- package/lib/cursor/aggregation_cursor.js.map +1 -1
- package/lib/cursor/client_bulk_write_cursor.js +52 -0
- package/lib/cursor/client_bulk_write_cursor.js.map +1 -0
- package/lib/cursor/find_cursor.js.map +1 -1
- package/lib/db.js +1 -1
- package/lib/error.js +76 -3
- package/lib/error.js.map +1 -1
- package/lib/explain.js +6 -6
- package/lib/explain.js.map +1 -1
- package/lib/index.js +6 -3
- package/lib/index.js.map +1 -1
- package/lib/mongo_client.js +14 -0
- package/lib/mongo_client.js.map +1 -1
- package/lib/mongo_client_auth_providers.js +6 -2
- package/lib/mongo_client_auth_providers.js.map +1 -1
- package/lib/mongo_types.js.map +1 -1
- package/lib/operations/aggregate.js.map +1 -1
- package/lib/operations/client_bulk_write/client_bulk_write.js +83 -0
- package/lib/operations/client_bulk_write/client_bulk_write.js.map +1 -0
- package/lib/operations/client_bulk_write/command_builder.js +154 -19
- package/lib/operations/client_bulk_write/command_builder.js.map +1 -1
- package/lib/operations/client_bulk_write/executor.js +109 -0
- package/lib/operations/client_bulk_write/executor.js.map +1 -0
- package/lib/operations/client_bulk_write/results_merger.js +204 -0
- package/lib/operations/client_bulk_write/results_merger.js.map +1 -0
- package/lib/operations/execute_operation.js +7 -0
- package/lib/operations/execute_operation.js.map +1 -1
- package/lib/operations/find.js.map +1 -1
- package/lib/operations/operation.js +5 -1
- package/lib/operations/operation.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/sdam/server.js +2 -1
- package/lib/sdam/server.js.map +1 -1
- package/lib/sdam/server_description.js +3 -0
- package/lib/sdam/server_description.js.map +1 -1
- package/lib/sdam/srv_polling.js +5 -1
- package/lib/sdam/srv_polling.js.map +1 -1
- package/lib/sdam/topology_description.js.map +1 -1
- package/lib/sessions.js +9 -2
- package/lib/sessions.js.map +1 -1
- package/lib/utils.js +25 -9
- package/lib/utils.js.map +1 -1
- package/lib/write_concern.js.map +1 -1
- package/mongodb.d.ts +407 -12
- package/package.json +2 -2
- package/src/beta.ts +1 -1
- package/src/bson.ts +3 -0
- package/src/bulk/common.ts +80 -120
- package/src/bulk/unordered.ts +3 -4
- package/src/change_stream.ts +5 -2
- package/src/cmap/auth/mongo_credentials.ts +2 -8
- package/src/cmap/auth/mongodb_oidc/callback_workflow.ts +1 -1
- package/src/cmap/auth/mongodb_oidc/command_builders.ts +1 -2
- package/src/cmap/auth/mongodb_oidc/human_callback_workflow.ts +1 -2
- package/src/cmap/auth/mongodb_oidc/machine_workflow.ts +1 -1
- package/src/cmap/auth/mongodb_oidc.ts +1 -2
- package/src/cmap/command_monitoring_events.ts +16 -2
- package/src/cmap/commands.ts +71 -25
- package/src/cmap/connection.ts +17 -4
- package/src/cmap/wire_protocol/constants.ts +2 -2
- package/src/cmap/wire_protocol/on_demand/document.ts +1 -2
- package/src/cmap/wire_protocol/responses.ts +31 -2
- package/src/connection_string.ts +2 -9
- package/src/cursor/aggregation_cursor.ts +2 -2
- package/src/cursor/client_bulk_write_cursor.ts +79 -0
- package/src/cursor/find_cursor.ts +2 -2
- package/src/db.ts +1 -1
- package/src/error.ts +98 -2
- package/src/explain.ts +47 -11
- package/src/index.ts +26 -1
- package/src/mongo_client.ts +29 -1
- package/src/mongo_client_auth_providers.ts +8 -2
- package/src/mongo_types.ts +2 -1
- package/src/operations/aggregate.ts +9 -1
- package/src/operations/client_bulk_write/client_bulk_write.ts +107 -0
- package/src/operations/client_bulk_write/command_builder.ts +216 -30
- package/src/operations/client_bulk_write/common.ts +148 -23
- package/src/operations/client_bulk_write/executor.ts +137 -0
- package/src/operations/client_bulk_write/results_merger.ts +260 -0
- package/src/operations/execute_operation.ts +8 -0
- package/src/operations/find.ts +8 -1
- package/src/operations/operation.ts +6 -1
- package/src/operations/search_indexes/create.ts +1 -2
- package/src/operations/search_indexes/drop.ts +1 -2
- package/src/operations/search_indexes/update.ts +1 -2
- package/src/sdam/server.ts +2 -1
- package/src/sdam/server_description.ts +9 -0
- package/src/sdam/srv_polling.ts +5 -2
- package/src/sdam/topology_description.ts +0 -1
- package/src/sessions.ts +16 -2
- package/src/utils.ts +40 -10
- package/src/write_concern.ts +4 -1
- package/lib/cmap/auth/mongocr.js +0 -35
- package/lib/cmap/auth/mongocr.js.map +0 -1
- package/src/cmap/auth/mongocr.ts +0 -38
package/lib/beta.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ObjectIdLike } from 'bson';
|
|
2
1
|
import type { DeserializeOptions } from 'bson';
|
|
2
|
+
import type { ObjectIdLike } from 'bson';
|
|
3
3
|
import type { SerializeOptions } from 'bson';
|
|
4
4
|
import { Binary } from 'bson';
|
|
5
5
|
import { BSON } from 'bson';
|
|
@@ -373,7 +373,7 @@ export declare class Admin {
|
|
|
373
373
|
/* Excluded from this release type: AggregateOperation */
|
|
374
374
|
|
|
375
375
|
/** @public */
|
|
376
|
-
export declare interface AggregateOptions extends CommandOperationOptions {
|
|
376
|
+
export declare interface AggregateOptions extends Omit<CommandOperationOptions, 'explain'> {
|
|
377
377
|
/** allowDiskUse lets the server know if it can use disk to store temporary results for the aggregation (requires mongodb 2.6 \>). */
|
|
378
378
|
allowDiskUse?: boolean;
|
|
379
379
|
/** The number of documents to return per batch. See [aggregation documentation](https://www.mongodb.com/docs/manual/reference/command/aggregate). */
|
|
@@ -393,6 +393,12 @@ export declare interface AggregateOptions extends CommandOperationOptions {
|
|
|
393
393
|
/** Map of parameter names and values that can be accessed using $$var (requires MongoDB 5.0). */
|
|
394
394
|
let?: Document;
|
|
395
395
|
out?: string;
|
|
396
|
+
/**
|
|
397
|
+
* Specifies the verbosity mode for the explain output.
|
|
398
|
+
* @deprecated This API is deprecated in favor of `collection.aggregate().explain()`
|
|
399
|
+
* or `db.aggregate().explain()`.
|
|
400
|
+
*/
|
|
401
|
+
explain?: ExplainOptions['explain'];
|
|
396
402
|
}
|
|
397
403
|
|
|
398
404
|
/**
|
|
@@ -410,7 +416,7 @@ export declare class AggregationCursor<TSchema = any> extends AbstractCursor<TSc
|
|
|
410
416
|
map<T>(transform: (doc: TSchema) => T): AggregationCursor<T>;
|
|
411
417
|
/* Excluded from this release type: _initialize */
|
|
412
418
|
/** Execute the explain for the cursor */
|
|
413
|
-
explain(verbosity?: ExplainVerbosityLike): Promise<Document>;
|
|
419
|
+
explain(verbosity?: ExplainVerbosityLike | ExplainCommandOptions): Promise<Document>;
|
|
414
420
|
/** Add a stage to the aggregation pipeline
|
|
415
421
|
* @example
|
|
416
422
|
* ```
|
|
@@ -519,6 +525,13 @@ export declare type AnyBulkWriteOperation<TSchema extends Document = Document> =
|
|
|
519
525
|
deleteMany: DeleteManyModel<TSchema>;
|
|
520
526
|
};
|
|
521
527
|
|
|
528
|
+
/**
|
|
529
|
+
* Used to represent any of the client bulk write models that can be passed as an array
|
|
530
|
+
* to MongoClient#bulkWrite.
|
|
531
|
+
* @public
|
|
532
|
+
*/
|
|
533
|
+
export declare type AnyClientBulkWriteModel<TSchema extends Document> = ClientInsertOneModel<TSchema> | ClientReplaceOneModel<TSchema> | ClientUpdateOneModel<TSchema> | ClientUpdateManyModel<TSchema> | ClientDeleteOneModel<TSchema> | ClientDeleteManyModel<TSchema>;
|
|
534
|
+
|
|
522
535
|
/** @public */
|
|
523
536
|
export declare type AnyError = MongoError | Error;
|
|
524
537
|
|
|
@@ -1494,6 +1507,137 @@ export declare interface ChangeStreamUpdateDocument<TSchema extends Document = D
|
|
|
1494
1507
|
fullDocumentBeforeChange?: TSchema;
|
|
1495
1508
|
}
|
|
1496
1509
|
|
|
1510
|
+
/** @public */
|
|
1511
|
+
export declare interface ClientBulkWriteError {
|
|
1512
|
+
code: number;
|
|
1513
|
+
message: string;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
/**
|
|
1517
|
+
* A mapping of namespace strings to collections schemas.
|
|
1518
|
+
* @public
|
|
1519
|
+
*
|
|
1520
|
+
* @example
|
|
1521
|
+
* ```ts
|
|
1522
|
+
* type MongoDBSchemas = {
|
|
1523
|
+
* 'db.books': Book;
|
|
1524
|
+
* 'db.authors': Author;
|
|
1525
|
+
* }
|
|
1526
|
+
*
|
|
1527
|
+
* const model: ClientBulkWriteModel<MongoDBSchemas> = {
|
|
1528
|
+
* namespace: 'db.books'
|
|
1529
|
+
* name: 'insertOne',
|
|
1530
|
+
* document: { title: 'Practical MongoDB Aggregations', authorName: 3 } // error `authorName` cannot be number
|
|
1531
|
+
* };
|
|
1532
|
+
* ```
|
|
1533
|
+
*
|
|
1534
|
+
* The type of the `namespace` field narrows other parts of the BulkWriteModel to use the correct schema for type assertions.
|
|
1535
|
+
*
|
|
1536
|
+
*/
|
|
1537
|
+
export declare type ClientBulkWriteModel<SchemaMap extends Record<string, Document> = Record<string, Document>> = {
|
|
1538
|
+
[Namespace in keyof SchemaMap]: AnyClientBulkWriteModel<SchemaMap[Namespace]> & {
|
|
1539
|
+
namespace: Namespace;
|
|
1540
|
+
};
|
|
1541
|
+
}[keyof SchemaMap];
|
|
1542
|
+
|
|
1543
|
+
/** @public */
|
|
1544
|
+
export declare interface ClientBulkWriteOptions extends CommandOperationOptions {
|
|
1545
|
+
/**
|
|
1546
|
+
* If true, when an insert fails, don't execute the remaining writes.
|
|
1547
|
+
* If false, continue with remaining inserts when one fails.
|
|
1548
|
+
* @defaultValue `true` - inserts are ordered by default
|
|
1549
|
+
*/
|
|
1550
|
+
ordered?: boolean;
|
|
1551
|
+
/**
|
|
1552
|
+
* Allow driver to bypass schema validation.
|
|
1553
|
+
* @defaultValue `false` - documents will be validated by default
|
|
1554
|
+
**/
|
|
1555
|
+
bypassDocumentValidation?: boolean;
|
|
1556
|
+
/** Map of parameter names and values that can be accessed using $$var (requires MongoDB 5.0). */
|
|
1557
|
+
let?: Document;
|
|
1558
|
+
/**
|
|
1559
|
+
* Whether detailed results for each successful operation should be included in the returned
|
|
1560
|
+
* BulkWriteResult.
|
|
1561
|
+
*/
|
|
1562
|
+
verboseResults?: boolean;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
/** @public */
|
|
1566
|
+
export declare interface ClientBulkWriteResult {
|
|
1567
|
+
/**
|
|
1568
|
+
* Whether the bulk write was acknowledged.
|
|
1569
|
+
*/
|
|
1570
|
+
readonly acknowledged: boolean;
|
|
1571
|
+
/**
|
|
1572
|
+
* The total number of documents inserted across all insert operations.
|
|
1573
|
+
*/
|
|
1574
|
+
readonly insertedCount: number;
|
|
1575
|
+
/**
|
|
1576
|
+
* The total number of documents upserted across all update operations.
|
|
1577
|
+
*/
|
|
1578
|
+
readonly upsertedCount: number;
|
|
1579
|
+
/**
|
|
1580
|
+
* The total number of documents matched across all update operations.
|
|
1581
|
+
*/
|
|
1582
|
+
readonly matchedCount: number;
|
|
1583
|
+
/**
|
|
1584
|
+
* The total number of documents modified across all update operations.
|
|
1585
|
+
*/
|
|
1586
|
+
readonly modifiedCount: number;
|
|
1587
|
+
/**
|
|
1588
|
+
* The total number of documents deleted across all delete operations.
|
|
1589
|
+
*/
|
|
1590
|
+
readonly deletedCount: number;
|
|
1591
|
+
/**
|
|
1592
|
+
* The results of each individual insert operation that was successfully performed.
|
|
1593
|
+
*/
|
|
1594
|
+
readonly insertResults?: ReadonlyMap<number, ClientInsertOneResult>;
|
|
1595
|
+
/**
|
|
1596
|
+
* The results of each individual update operation that was successfully performed.
|
|
1597
|
+
*/
|
|
1598
|
+
readonly updateResults?: ReadonlyMap<number, ClientUpdateResult>;
|
|
1599
|
+
/**
|
|
1600
|
+
* The results of each individual delete operation that was successfully performed.
|
|
1601
|
+
*/
|
|
1602
|
+
readonly deleteResults?: ReadonlyMap<number, ClientDeleteResult>;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
/** @public */
|
|
1606
|
+
export declare interface ClientDeleteManyModel<TSchema> extends ClientWriteModel {
|
|
1607
|
+
name: 'deleteMany';
|
|
1608
|
+
/**
|
|
1609
|
+
* The filter used to determine if a document should be deleted.
|
|
1610
|
+
* For a deleteMany operation, all matches are removed.
|
|
1611
|
+
*/
|
|
1612
|
+
filter: Filter<TSchema>;
|
|
1613
|
+
/** Specifies a collation. */
|
|
1614
|
+
collation?: CollationOptions;
|
|
1615
|
+
/** The index to use. If specified, then the query system will only consider plans using the hinted index. */
|
|
1616
|
+
hint?: Hint;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
/** @public */
|
|
1620
|
+
export declare interface ClientDeleteOneModel<TSchema> extends ClientWriteModel {
|
|
1621
|
+
name: 'deleteOne';
|
|
1622
|
+
/**
|
|
1623
|
+
* The filter used to determine if a document should be deleted.
|
|
1624
|
+
* For a deleteOne operation, the first match is removed.
|
|
1625
|
+
*/
|
|
1626
|
+
filter: Filter<TSchema>;
|
|
1627
|
+
/** Specifies a collation. */
|
|
1628
|
+
collation?: CollationOptions;
|
|
1629
|
+
/** The index to use. If specified, then the query system will only consider plans using the hinted index. */
|
|
1630
|
+
hint?: Hint;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
/** @public */
|
|
1634
|
+
export declare interface ClientDeleteResult {
|
|
1635
|
+
/**
|
|
1636
|
+
* The number of documents that were deleted.
|
|
1637
|
+
*/
|
|
1638
|
+
deletedCount: number;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1497
1641
|
/**
|
|
1498
1642
|
* @public
|
|
1499
1643
|
* The public interface for explicit in-use encryption
|
|
@@ -1915,6 +2059,21 @@ export declare type ClientEncryptionSocketOptions = Pick<MongoClientOptions, 'au
|
|
|
1915
2059
|
*/
|
|
1916
2060
|
export declare type ClientEncryptionTlsOptions = Pick<MongoClientOptions, 'tlsCAFile' | 'tlsCertificateKeyFile' | 'tlsCertificateKeyFilePassword'>;
|
|
1917
2061
|
|
|
2062
|
+
/** @public */
|
|
2063
|
+
export declare interface ClientInsertOneModel<TSchema> extends ClientWriteModel {
|
|
2064
|
+
name: 'insertOne';
|
|
2065
|
+
/** The document to insert. */
|
|
2066
|
+
document: OptionalId<TSchema>;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
/** @public */
|
|
2070
|
+
export declare interface ClientInsertOneResult {
|
|
2071
|
+
/**
|
|
2072
|
+
* The _id of the inserted document.
|
|
2073
|
+
*/
|
|
2074
|
+
insertedId: any;
|
|
2075
|
+
}
|
|
2076
|
+
|
|
1918
2077
|
/**
|
|
1919
2078
|
* @public
|
|
1920
2079
|
* @see https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.rst#hello-command
|
|
@@ -1954,6 +2113,24 @@ export declare interface ClientMetadataOptions {
|
|
|
1954
2113
|
appName?: string;
|
|
1955
2114
|
}
|
|
1956
2115
|
|
|
2116
|
+
/** @public */
|
|
2117
|
+
export declare interface ClientReplaceOneModel<TSchema> extends ClientWriteModel {
|
|
2118
|
+
name: 'replaceOne';
|
|
2119
|
+
/**
|
|
2120
|
+
* The filter used to determine if a document should be replaced.
|
|
2121
|
+
* For a replaceOne operation, the first match is replaced.
|
|
2122
|
+
*/
|
|
2123
|
+
filter: Filter<TSchema>;
|
|
2124
|
+
/** The document with which to replace the matched document. */
|
|
2125
|
+
replacement: WithoutId<TSchema>;
|
|
2126
|
+
/** Specifies a collation. */
|
|
2127
|
+
collation?: CollationOptions;
|
|
2128
|
+
/** The index to use. If specified, then the query system will only consider plans using the hinted index. */
|
|
2129
|
+
hint?: Hint;
|
|
2130
|
+
/** When true, creates a new document if no document matches the query. */
|
|
2131
|
+
upsert?: boolean;
|
|
2132
|
+
}
|
|
2133
|
+
|
|
1957
2134
|
/**
|
|
1958
2135
|
* A class representing a client session on the server
|
|
1959
2136
|
*
|
|
@@ -1974,6 +2151,7 @@ export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents
|
|
|
1974
2151
|
/* Excluded from this release type: owner */
|
|
1975
2152
|
defaultTransactionOptions: TransactionOptions;
|
|
1976
2153
|
transaction: Transaction;
|
|
2154
|
+
/* Excluded from this release type: commitAttempted */
|
|
1977
2155
|
/* Excluded from this release type: [kServerSession] */
|
|
1978
2156
|
/* Excluded from this release type: [kSnapshotTime] */
|
|
1979
2157
|
/* Excluded from this release type: [kSnapshotEnabled] */
|
|
@@ -2113,6 +2291,91 @@ export declare interface ClientSessionOptions {
|
|
|
2113
2291
|
/* Excluded from this release type: initialClusterTime */
|
|
2114
2292
|
}
|
|
2115
2293
|
|
|
2294
|
+
/** @public */
|
|
2295
|
+
export declare interface ClientUpdateManyModel<TSchema> extends ClientWriteModel {
|
|
2296
|
+
name: 'updateMany';
|
|
2297
|
+
/**
|
|
2298
|
+
* The filter used to determine if a document should be updated.
|
|
2299
|
+
* For an updateMany operation, all matches are updated.
|
|
2300
|
+
*/
|
|
2301
|
+
filter: Filter<TSchema>;
|
|
2302
|
+
/**
|
|
2303
|
+
* The modifications to apply. The value can be either:
|
|
2304
|
+
* UpdateFilter<Document> - A document that contains update operator expressions,
|
|
2305
|
+
* Document[] - an aggregation pipeline.
|
|
2306
|
+
*/
|
|
2307
|
+
update: UpdateFilter<TSchema> | Document[];
|
|
2308
|
+
/** A set of filters specifying to which array elements an update should apply. */
|
|
2309
|
+
arrayFilters?: Document[];
|
|
2310
|
+
/** Specifies a collation. */
|
|
2311
|
+
collation?: CollationOptions;
|
|
2312
|
+
/** The index to use. If specified, then the query system will only consider plans using the hinted index. */
|
|
2313
|
+
hint?: Hint;
|
|
2314
|
+
/** When true, creates a new document if no document matches the query. */
|
|
2315
|
+
upsert?: boolean;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
/** @public */
|
|
2319
|
+
export declare interface ClientUpdateOneModel<TSchema> extends ClientWriteModel {
|
|
2320
|
+
name: 'updateOne';
|
|
2321
|
+
/**
|
|
2322
|
+
* The filter used to determine if a document should be updated.
|
|
2323
|
+
* For an updateOne operation, the first match is updated.
|
|
2324
|
+
*/
|
|
2325
|
+
filter: Filter<TSchema>;
|
|
2326
|
+
/**
|
|
2327
|
+
* The modifications to apply. The value can be either:
|
|
2328
|
+
* UpdateFilter<Document> - A document that contains update operator expressions,
|
|
2329
|
+
* Document[] - an aggregation pipeline.
|
|
2330
|
+
*/
|
|
2331
|
+
update: UpdateFilter<TSchema> | Document[];
|
|
2332
|
+
/** A set of filters specifying to which array elements an update should apply. */
|
|
2333
|
+
arrayFilters?: Document[];
|
|
2334
|
+
/** Specifies a collation. */
|
|
2335
|
+
collation?: CollationOptions;
|
|
2336
|
+
/** The index to use. If specified, then the query system will only consider plans using the hinted index. */
|
|
2337
|
+
hint?: Hint;
|
|
2338
|
+
/** When true, creates a new document if no document matches the query. */
|
|
2339
|
+
upsert?: boolean;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
/** @public */
|
|
2343
|
+
export declare interface ClientUpdateResult {
|
|
2344
|
+
/**
|
|
2345
|
+
* The number of documents that matched the filter.
|
|
2346
|
+
*/
|
|
2347
|
+
matchedCount: number;
|
|
2348
|
+
/**
|
|
2349
|
+
* The number of documents that were modified.
|
|
2350
|
+
*/
|
|
2351
|
+
modifiedCount: number;
|
|
2352
|
+
/**
|
|
2353
|
+
* The _id field of the upserted document if an upsert occurred.
|
|
2354
|
+
*
|
|
2355
|
+
* It MUST be possible to discern between a BSON Null upserted ID value and this field being
|
|
2356
|
+
* unset. If necessary, drivers MAY add a didUpsert boolean field to differentiate between
|
|
2357
|
+
* these two cases.
|
|
2358
|
+
*/
|
|
2359
|
+
upsertedId?: any;
|
|
2360
|
+
/**
|
|
2361
|
+
* Determines if the upsert did include an _id, which includes the case of the _id being null.
|
|
2362
|
+
*/
|
|
2363
|
+
didUpsert: boolean;
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
/** @public */
|
|
2367
|
+
export declare interface ClientWriteModel {
|
|
2368
|
+
/**
|
|
2369
|
+
* The namespace for the write.
|
|
2370
|
+
*
|
|
2371
|
+
* A namespace is a combination of the database name and the name of the collection: `<database-name>.<collection>`.
|
|
2372
|
+
* All documents belong to a namespace.
|
|
2373
|
+
*
|
|
2374
|
+
* @see https://www.mongodb.com/docs/manual/reference/limits/#std-label-faq-dev-namespace
|
|
2375
|
+
*/
|
|
2376
|
+
namespace: string;
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2116
2379
|
/**
|
|
2117
2380
|
* @public
|
|
2118
2381
|
* @deprecated This interface is deprecated and will be removed in a future release as it is not used
|
|
@@ -3375,7 +3638,7 @@ export declare class Db {
|
|
|
3375
3638
|
*/
|
|
3376
3639
|
command(command: Document, options?: RunCommandOptions): Promise<Document>;
|
|
3377
3640
|
/**
|
|
3378
|
-
* Execute an aggregation framework pipeline against the database
|
|
3641
|
+
* Execute an aggregation framework pipeline against the database.
|
|
3379
3642
|
*
|
|
3380
3643
|
* @param pipeline - An array of aggregation stages to be executed
|
|
3381
3644
|
* @param options - Optional settings for the command
|
|
@@ -3668,9 +3931,45 @@ export declare type EventsDescription = Record<string, GenericListener>;
|
|
|
3668
3931
|
/* Excluded from this release type: Explain */
|
|
3669
3932
|
|
|
3670
3933
|
/** @public */
|
|
3934
|
+
export declare interface ExplainCommandOptions {
|
|
3935
|
+
/** The explain verbosity for the command. */
|
|
3936
|
+
verbosity: ExplainVerbosity;
|
|
3937
|
+
/** The maxTimeMS setting for the command. */
|
|
3938
|
+
maxTimeMS?: number;
|
|
3939
|
+
}
|
|
3940
|
+
|
|
3941
|
+
/**
|
|
3942
|
+
* @public
|
|
3943
|
+
*
|
|
3944
|
+
* When set, this configures an explain command. Valid values are boolean (for legacy compatibility,
|
|
3945
|
+
* see {@link ExplainVerbosityLike}), a string containing the explain verbosity, or an object containing the verbosity and
|
|
3946
|
+
* an optional maxTimeMS.
|
|
3947
|
+
*
|
|
3948
|
+
* Examples of valid usage:
|
|
3949
|
+
*
|
|
3950
|
+
* ```typescript
|
|
3951
|
+
* collection.find({ name: 'john doe' }, { explain: true });
|
|
3952
|
+
* collection.find({ name: 'john doe' }, { explain: false });
|
|
3953
|
+
* collection.find({ name: 'john doe' }, { explain: 'queryPlanner' });
|
|
3954
|
+
* collection.find({ name: 'john doe' }, { explain: { verbosity: 'queryPlanner' } });
|
|
3955
|
+
* ```
|
|
3956
|
+
*
|
|
3957
|
+
* maxTimeMS can be configured to limit the amount of time the server
|
|
3958
|
+
* spends executing an explain by providing an object:
|
|
3959
|
+
*
|
|
3960
|
+
* ```typescript
|
|
3961
|
+
* // limits the `explain` command to no more than 2 seconds
|
|
3962
|
+
* collection.find({ name: 'john doe' }, {
|
|
3963
|
+
* explain: {
|
|
3964
|
+
* verbosity: 'queryPlanner',
|
|
3965
|
+
* maxTimeMS: 2000
|
|
3966
|
+
* }
|
|
3967
|
+
* });
|
|
3968
|
+
* ```
|
|
3969
|
+
*/
|
|
3671
3970
|
export declare interface ExplainOptions {
|
|
3672
3971
|
/** Specifies the verbosity mode for the explain output. */
|
|
3673
|
-
explain?: ExplainVerbosityLike;
|
|
3972
|
+
explain?: ExplainVerbosityLike | ExplainCommandOptions;
|
|
3674
3973
|
}
|
|
3675
3974
|
|
|
3676
3975
|
/** @public */
|
|
@@ -3686,8 +3985,7 @@ export declare type ExplainVerbosity = string;
|
|
|
3686
3985
|
|
|
3687
3986
|
/**
|
|
3688
3987
|
* For backwards compatibility, true is interpreted as "allPlansExecution"
|
|
3689
|
-
* and false as "queryPlanner".
|
|
3690
|
-
* ignores the verbosity parameter and executes in "queryPlanner".
|
|
3988
|
+
* and false as "queryPlanner".
|
|
3691
3989
|
* @public
|
|
3692
3990
|
*/
|
|
3693
3991
|
export declare type ExplainVerbosityLike = ExplainVerbosity | boolean;
|
|
@@ -3757,7 +4055,7 @@ export declare class FindCursor<TSchema = any> extends AbstractCursor<TSchema> {
|
|
|
3757
4055
|
*/
|
|
3758
4056
|
count(options?: CountOptions): Promise<number>;
|
|
3759
4057
|
/** Execute the explain for the cursor */
|
|
3760
|
-
explain(verbosity?: ExplainVerbosityLike): Promise<Document>;
|
|
4058
|
+
explain(verbosity?: ExplainVerbosityLike | ExplainCommandOptions): Promise<Document>;
|
|
3761
4059
|
/** Set the cursor query */
|
|
3762
4060
|
filter(filter: Document): this;
|
|
3763
4061
|
/**
|
|
@@ -3987,7 +4285,7 @@ export declare class FindOperators {
|
|
|
3987
4285
|
* @public
|
|
3988
4286
|
* @typeParam TSchema - Unused schema definition, deprecated usage, only specify `FindOptions` with no generic
|
|
3989
4287
|
*/
|
|
3990
|
-
export declare interface FindOptions<TSchema extends Document = Document> extends Omit<CommandOperationOptions, 'writeConcern'> {
|
|
4288
|
+
export declare interface FindOptions<TSchema extends Document = Document> extends Omit<CommandOperationOptions, 'writeConcern' | 'explain'> {
|
|
3991
4289
|
/** Sets the limit of documents returned in the query. */
|
|
3992
4290
|
limit?: number;
|
|
3993
4291
|
/** Set to sort the documents coming back from the query. Array of indexes, `[['a', 1]]` etc. */
|
|
@@ -4035,6 +4333,11 @@ export declare interface FindOptions<TSchema extends Document = Document> extend
|
|
|
4035
4333
|
* @deprecated Starting from MongoDB 4.4 this flag is not needed and will be ignored.
|
|
4036
4334
|
*/
|
|
4037
4335
|
oplogReplay?: boolean;
|
|
4336
|
+
/**
|
|
4337
|
+
* Specifies the verbosity mode for the explain output.
|
|
4338
|
+
* @deprecated This API is deprecated in favor of `collection.find().explain()`.
|
|
4339
|
+
*/
|
|
4340
|
+
explain?: ExplainOptions['explain'];
|
|
4038
4341
|
}
|
|
4039
4342
|
|
|
4040
4343
|
/** @public */
|
|
@@ -5013,6 +5316,13 @@ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> im
|
|
|
5013
5316
|
get writeConcern(): WriteConcern | undefined;
|
|
5014
5317
|
get readPreference(): ReadPreference;
|
|
5015
5318
|
get bsonOptions(): BSONSerializeOptions;
|
|
5319
|
+
/**
|
|
5320
|
+
* Executes a client bulk write operation, available on server 8.0+.
|
|
5321
|
+
* @param models - The client bulk write models.
|
|
5322
|
+
* @param options - The client bulk write options.
|
|
5323
|
+
* @returns A ClientBulkWriteResult for acknowledged writes and ok: 1 for unacknowledged writes.
|
|
5324
|
+
*/
|
|
5325
|
+
bulkWrite<SchemaMap extends Record<string, Document> = Record<string, Document>>(models: ReadonlyArray<ClientBulkWriteModel<SchemaMap>>, options?: ClientBulkWriteOptions): Promise<ClientBulkWriteResult>;
|
|
5016
5326
|
/**
|
|
5017
5327
|
* Connect to MongoDB using a url
|
|
5018
5328
|
*
|
|
@@ -5088,6 +5398,80 @@ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> im
|
|
|
5088
5398
|
|
|
5089
5399
|
/* Excluded from this release type: MongoClientAuthProviders */
|
|
5090
5400
|
|
|
5401
|
+
/**
|
|
5402
|
+
* An error indicating that an error occurred when processing bulk write results.
|
|
5403
|
+
*
|
|
5404
|
+
* @public
|
|
5405
|
+
* @category Error
|
|
5406
|
+
*/
|
|
5407
|
+
export declare class MongoClientBulkWriteCursorError extends MongoRuntimeError {
|
|
5408
|
+
/**
|
|
5409
|
+
* **Do not use this constructor!**
|
|
5410
|
+
*
|
|
5411
|
+
* Meant for internal use only.
|
|
5412
|
+
*
|
|
5413
|
+
* @remarks
|
|
5414
|
+
* This class is only meant to be constructed within the driver. This constructor is
|
|
5415
|
+
* not subject to semantic versioning compatibility guarantees and may change at any time.
|
|
5416
|
+
*
|
|
5417
|
+
* @public
|
|
5418
|
+
**/
|
|
5419
|
+
constructor(message: string);
|
|
5420
|
+
get name(): string;
|
|
5421
|
+
}
|
|
5422
|
+
|
|
5423
|
+
/**
|
|
5424
|
+
* An error indicating that an error occurred when executing the bulk write.
|
|
5425
|
+
*
|
|
5426
|
+
* @public
|
|
5427
|
+
* @category Error
|
|
5428
|
+
*/
|
|
5429
|
+
export declare class MongoClientBulkWriteError extends MongoServerError {
|
|
5430
|
+
/**
|
|
5431
|
+
* Write concern errors that occurred while executing the bulk write. This list may have
|
|
5432
|
+
* multiple items if more than one server command was required to execute the bulk write.
|
|
5433
|
+
*/
|
|
5434
|
+
writeConcernErrors: Document[];
|
|
5435
|
+
/**
|
|
5436
|
+
* Errors that occurred during the execution of individual write operations. This map will
|
|
5437
|
+
* contain at most one entry if the bulk write was ordered.
|
|
5438
|
+
*/
|
|
5439
|
+
writeErrors: Map<number, ClientBulkWriteError>;
|
|
5440
|
+
/**
|
|
5441
|
+
* The results of any successful operations that were performed before the error was
|
|
5442
|
+
* encountered.
|
|
5443
|
+
*/
|
|
5444
|
+
partialResult?: ClientBulkWriteResult;
|
|
5445
|
+
/**
|
|
5446
|
+
* Initialize the client bulk write error.
|
|
5447
|
+
* @param message - The error message.
|
|
5448
|
+
*/
|
|
5449
|
+
constructor(message: ErrorDescription);
|
|
5450
|
+
get name(): string;
|
|
5451
|
+
}
|
|
5452
|
+
|
|
5453
|
+
/**
|
|
5454
|
+
* An error indicating that an error occurred on the client when executing a client bulk write.
|
|
5455
|
+
*
|
|
5456
|
+
* @public
|
|
5457
|
+
* @category Error
|
|
5458
|
+
*/
|
|
5459
|
+
export declare class MongoClientBulkWriteExecutionError extends MongoRuntimeError {
|
|
5460
|
+
/**
|
|
5461
|
+
* **Do not use this constructor!**
|
|
5462
|
+
*
|
|
5463
|
+
* Meant for internal use only.
|
|
5464
|
+
*
|
|
5465
|
+
* @remarks
|
|
5466
|
+
* This class is only meant to be constructed within the driver. This constructor is
|
|
5467
|
+
* not subject to semantic versioning compatibility guarantees and may change at any time.
|
|
5468
|
+
*
|
|
5469
|
+
* @public
|
|
5470
|
+
**/
|
|
5471
|
+
constructor(message: string);
|
|
5472
|
+
get name(): string;
|
|
5473
|
+
}
|
|
5474
|
+
|
|
5091
5475
|
/** @public */
|
|
5092
5476
|
export declare type MongoClientEvents = Pick<TopologyEvents, (typeof MONGO_CLIENT_EVENTS)[number]> & {
|
|
5093
5477
|
open(mongoClient: MongoClient): void;
|
|
@@ -5735,7 +6119,9 @@ export declare class MongoInvalidArgumentError extends MongoAPIError {
|
|
|
5735
6119
|
*
|
|
5736
6120
|
* @public
|
|
5737
6121
|
**/
|
|
5738
|
-
constructor(message: string
|
|
6122
|
+
constructor(message: string, options?: {
|
|
6123
|
+
cause?: Error;
|
|
6124
|
+
});
|
|
5739
6125
|
get name(): string;
|
|
5740
6126
|
}
|
|
5741
6127
|
|
|
@@ -6972,6 +7358,12 @@ export declare class ServerDescription {
|
|
|
6972
7358
|
setVersion: number | null;
|
|
6973
7359
|
electionId: ObjectId | null;
|
|
6974
7360
|
logicalSessionTimeoutMinutes: number | null;
|
|
7361
|
+
/** The max message size in bytes for the server. */
|
|
7362
|
+
maxMessageSizeBytes: number | null;
|
|
7363
|
+
/** The max number of writes in a bulk write command. */
|
|
7364
|
+
maxWriteBatchSize: number | null;
|
|
7365
|
+
/** The max bson object size. */
|
|
7366
|
+
maxBsonObjectSize: number | null;
|
|
6975
7367
|
$clusterTime?: ClusterTime;
|
|
6976
7368
|
/* Excluded from this release type: __constructor */
|
|
6977
7369
|
get hostAddress(): HostAddress;
|
|
@@ -7555,7 +7947,7 @@ export declare class TypedEventEmitter<Events extends EventsDescription> extends
|
|
|
7555
7947
|
/** @public */
|
|
7556
7948
|
export declare class UnorderedBulkOperation extends BulkOperationBase {
|
|
7557
7949
|
/* Excluded from this release type: __constructor */
|
|
7558
|
-
handleWriteError(
|
|
7950
|
+
handleWriteError(writeResult: BulkWriteResult): void;
|
|
7559
7951
|
addToOperationsList(batchType: BatchType, document: Document | UpdateStatement | DeleteStatement): this;
|
|
7560
7952
|
}
|
|
7561
7953
|
|
|
@@ -7763,7 +8155,10 @@ export declare type WithTransactionCallback<T = any> = (session: ClientSession)
|
|
|
7763
8155
|
* @see https://www.mongodb.com/docs/manual/reference/write-concern/
|
|
7764
8156
|
*/
|
|
7765
8157
|
export declare class WriteConcern {
|
|
7766
|
-
/**
|
|
8158
|
+
/**
|
|
8159
|
+
* Request acknowledgment that the write operation has propagated to a specified number of mongod instances or to mongod instances with specified tags.
|
|
8160
|
+
* If w is 0 and is set on a write operation, the server will not send a response.
|
|
8161
|
+
*/
|
|
7767
8162
|
readonly w?: W;
|
|
7768
8163
|
/** Request acknowledgment that the write operation has been written to the on-disk journal */
|
|
7769
8164
|
readonly journal?: boolean;
|
package/lib/bson.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.parseToElementsToArray = parseToElementsToArray;
|
|
|
5
5
|
exports.pluckBSONSerializeOptions = pluckBSONSerializeOptions;
|
|
6
6
|
exports.resolveBSONOptions = resolveBSONOptions;
|
|
7
7
|
exports.parseUtf8ValidationOption = parseUtf8ValidationOption;
|
|
8
|
+
/* eslint-disable no-restricted-imports */
|
|
8
9
|
const bson_1 = require("bson");
|
|
9
10
|
var bson_2 = require("bson");
|
|
10
11
|
Object.defineProperty(exports, "Binary", { enumerable: true, get: function () { return bson_2.Binary; } });
|
package/lib/bson.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bson.js","sourceRoot":"","sources":["../src/bson.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"bson.js","sourceRoot":"","sources":["../src/bson.ts"],"names":[],"mappings":"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"}
|