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
|
@@ -21,11 +21,13 @@ export interface SearchIndexDescription extends Document {
|
|
|
21
21
|
|
|
22
22
|
/** @internal */
|
|
23
23
|
export class CreateSearchIndexesOperation extends AbstractOperation<string[]> {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
) {
|
|
24
|
+
private readonly collection: Collection;
|
|
25
|
+
private readonly descriptions: ReadonlyArray<SearchIndexDescription>;
|
|
26
|
+
|
|
27
|
+
constructor(collection: Collection, descriptions: ReadonlyArray<SearchIndexDescription>) {
|
|
28
28
|
super();
|
|
29
|
+
this.collection = collection;
|
|
30
|
+
this.descriptions = descriptions;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
override get commandName() {
|
|
@@ -8,11 +8,13 @@ import { AbstractOperation } from '../operation';
|
|
|
8
8
|
|
|
9
9
|
/** @internal */
|
|
10
10
|
export class DropSearchIndexOperation extends AbstractOperation<void> {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
) {
|
|
11
|
+
private readonly collection: Collection;
|
|
12
|
+
private readonly name: string;
|
|
13
|
+
|
|
14
|
+
constructor(collection: Collection, name: string) {
|
|
15
15
|
super();
|
|
16
|
+
this.collection = collection;
|
|
17
|
+
this.name = name;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
override get commandName() {
|
|
@@ -7,12 +7,15 @@ import { AbstractOperation } from '../operation';
|
|
|
7
7
|
|
|
8
8
|
/** @internal */
|
|
9
9
|
export class UpdateSearchIndexOperation extends AbstractOperation<void> {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
) {
|
|
10
|
+
private readonly collection: Collection;
|
|
11
|
+
private readonly name: string;
|
|
12
|
+
private readonly definition: Document;
|
|
13
|
+
|
|
14
|
+
constructor(collection: Collection, name: string, definition: Document) {
|
|
15
15
|
super();
|
|
16
|
+
this.collection = collection;
|
|
17
|
+
this.name = name;
|
|
18
|
+
this.definition = definition;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
override get commandName() {
|
package/src/sessions.ts
CHANGED
|
@@ -121,6 +121,7 @@ export class ClientSession
|
|
|
121
121
|
/** @internal */
|
|
122
122
|
owner?: symbol | AbstractCursor;
|
|
123
123
|
defaultTransactionOptions: TransactionOptions;
|
|
124
|
+
/** @deprecated - Will be made internal in the next major release */
|
|
124
125
|
transaction: Transaction;
|
|
125
126
|
/**
|
|
126
127
|
* @internal
|
package/src/transactions.ts
CHANGED
|
@@ -74,11 +74,13 @@ export interface TransactionOptions extends Omit<CommandOperationOptions, 'timeo
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* @public
|
|
77
|
+
* @deprecated - Will be made internal in a future major release.
|
|
77
78
|
* A class maintaining state related to a server transaction. Internal Only
|
|
78
79
|
*/
|
|
79
80
|
export class Transaction {
|
|
80
81
|
/** @internal */
|
|
81
82
|
state: TxnState;
|
|
83
|
+
/** @deprecated - Will be made internal in a future major release. */
|
|
82
84
|
options: TransactionOptions;
|
|
83
85
|
/** @internal */
|
|
84
86
|
_pinnedServer?: Server;
|
|
@@ -122,26 +124,33 @@ export class Transaction {
|
|
|
122
124
|
return this._pinnedServer;
|
|
123
125
|
}
|
|
124
126
|
|
|
127
|
+
/** @deprecated - Will be made internal in a future major release. */
|
|
125
128
|
get recoveryToken(): Document | undefined {
|
|
126
129
|
return this._recoveryToken;
|
|
127
130
|
}
|
|
128
131
|
|
|
132
|
+
/** @deprecated - Will be made internal in a future major release. */
|
|
129
133
|
get isPinned(): boolean {
|
|
130
134
|
return !!this.server;
|
|
131
135
|
}
|
|
132
136
|
|
|
133
|
-
/**
|
|
137
|
+
/**
|
|
138
|
+
* @deprecated - Will be made internal in a future major release.
|
|
139
|
+
* @returns Whether the transaction has started
|
|
140
|
+
*/
|
|
134
141
|
get isStarting(): boolean {
|
|
135
142
|
return this.state === TxnState.STARTING_TRANSACTION;
|
|
136
143
|
}
|
|
137
144
|
|
|
138
145
|
/**
|
|
146
|
+
* @deprecated - Will be made internal in a future major release.
|
|
139
147
|
* @returns Whether this session is presently in a transaction
|
|
140
148
|
*/
|
|
141
149
|
get isActive(): boolean {
|
|
142
150
|
return ACTIVE_STATES.has(this.state);
|
|
143
151
|
}
|
|
144
152
|
|
|
153
|
+
/** @deprecated - Will be made internal in a future major release. */
|
|
145
154
|
get isCommitted(): boolean {
|
|
146
155
|
return COMMITTED_STATES.has(this.state);
|
|
147
156
|
}
|
package/src/utils.ts
CHANGED
|
@@ -281,16 +281,16 @@ export function ns(ns: string): MongoDBNamespace {
|
|
|
281
281
|
|
|
282
282
|
/** @public */
|
|
283
283
|
export class MongoDBNamespace {
|
|
284
|
+
db: string;
|
|
285
|
+
collection?: string;
|
|
284
286
|
/**
|
|
285
287
|
* Create a namespace object
|
|
286
288
|
*
|
|
287
289
|
* @param db - database name
|
|
288
290
|
* @param collection - collection name
|
|
289
291
|
*/
|
|
290
|
-
constructor(
|
|
291
|
-
|
|
292
|
-
public collection?: string
|
|
293
|
-
) {
|
|
292
|
+
constructor(db: string, collection?: string) {
|
|
293
|
+
this.db = db;
|
|
294
294
|
this.collection = collection === '' ? undefined : collection;
|
|
295
295
|
}
|
|
296
296
|
|
|
@@ -322,11 +322,11 @@ export class MongoDBNamespace {
|
|
|
322
322
|
* used in scenarios where this can be guaranteed.
|
|
323
323
|
*/
|
|
324
324
|
export class MongoDBCollectionNamespace extends MongoDBNamespace {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
) {
|
|
325
|
+
override collection: string;
|
|
326
|
+
|
|
327
|
+
constructor(db: string, collection: string) {
|
|
329
328
|
super(db, collection);
|
|
329
|
+
this.collection = collection;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
static override fromString(namespace?: string): MongoDBCollectionNamespace {
|
package/src/write_concern.ts
CHANGED
|
@@ -143,6 +143,7 @@ export class WriteConcern {
|
|
|
143
143
|
const parentOpts: WriteConcern | WriteConcernSettings | undefined =
|
|
144
144
|
inherit instanceof WriteConcern ? inherit : inherit.writeConcern;
|
|
145
145
|
|
|
146
|
+
const mergedOpts = { ...parentOpts, ...opts } as WriteConcernSettings;
|
|
146
147
|
const {
|
|
147
148
|
w = undefined,
|
|
148
149
|
wtimeout = undefined,
|
|
@@ -150,10 +151,7 @@ export class WriteConcern {
|
|
|
150
151
|
fsync = undefined,
|
|
151
152
|
journal = undefined,
|
|
152
153
|
wtimeoutMS = undefined
|
|
153
|
-
} =
|
|
154
|
-
...parentOpts,
|
|
155
|
-
...opts
|
|
156
|
-
};
|
|
154
|
+
} = mergedOpts;
|
|
157
155
|
if (
|
|
158
156
|
w != null ||
|
|
159
157
|
wtimeout != null ||
|