mongodb 6.19.0-dev.20250906.sha.82d6ce6a → 6.19.0-dev.20250909.sha.43c85189
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 +16 -9
- package/lib/change_stream.js +5 -1
- package/lib/change_stream.js.map +1 -1
- package/lib/cmap/wire_protocol/constants.js +5 -3
- package/lib/cmap/wire_protocol/constants.js.map +1 -1
- package/lib/operations/aggregate.js +2 -1
- package/lib/operations/aggregate.js.map +1 -1
- package/lib/operations/client_bulk_write/client_bulk_write.js +2 -1
- package/lib/operations/client_bulk_write/client_bulk_write.js.map +1 -1
- package/lib/operations/command.js +6 -0
- 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/delete.js +9 -3
- package/lib/operations/delete.js.map +1 -1
- package/lib/operations/distinct.js +6 -1
- package/lib/operations/distinct.js.map +1 -1
- package/lib/operations/estimated_document_count.js +2 -1
- package/lib/operations/estimated_document_count.js.map +1 -1
- package/lib/operations/find.js +2 -1
- package/lib/operations/find.js.map +1 -1
- package/lib/operations/find_and_modify.js +2 -1
- package/lib/operations/find_and_modify.js.map +1 -1
- package/lib/operations/indexes.js +4 -3
- package/lib/operations/indexes.js.map +1 -1
- package/lib/operations/insert.js +10 -2
- package/lib/operations/insert.js.map +1 -1
- package/lib/operations/list_collections.js +2 -1
- package/lib/operations/list_collections.js.map +1 -1
- package/lib/operations/operation.js +2 -1
- package/lib/operations/operation.js.map +1 -1
- package/lib/operations/update.js +12 -4
- package/lib/operations/update.js.map +1 -1
- package/lib/utils.js +22 -17
- package/lib/utils.js.map +1 -1
- package/mongodb.d.ts +16 -9
- package/package.json +1 -1
- package/src/change_stream.ts +5 -1
- package/src/cmap/wire_protocol/constants.ts +4 -2
- package/src/operations/aggregate.ts +2 -1
- package/src/operations/client_bulk_write/client_bulk_write.ts +2 -1
- package/src/operations/command.ts +18 -1
- package/src/operations/count.ts +1 -1
- package/src/operations/create_collection.ts +1 -1
- package/src/operations/delete.ts +9 -3
- package/src/operations/distinct.ts +6 -1
- package/src/operations/drop.ts +1 -1
- package/src/operations/estimated_document_count.ts +2 -1
- package/src/operations/find.ts +2 -1
- package/src/operations/find_and_modify.ts +2 -1
- package/src/operations/indexes.ts +5 -4
- package/src/operations/insert.ts +10 -2
- package/src/operations/list_collections.ts +2 -1
- package/src/operations/list_databases.ts +1 -1
- package/src/operations/operation.ts +2 -1
- package/src/operations/profiling_level.ts +1 -1
- package/src/operations/remove_user.ts +1 -1
- package/src/operations/rename.ts +1 -1
- package/src/operations/set_profiling_level.ts +1 -1
- package/src/operations/stats.ts +1 -1
- package/src/operations/update.ts +12 -4
- package/src/operations/validate_collection.ts +1 -1
- package/src/utils.ts +23 -17
|
@@ -6,7 +6,7 @@ import { MongoUnexpectedServerResponseError } from '../error';
|
|
|
6
6
|
import { CommandOperation, type CommandOperationOptions } from './command';
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
|
-
export type ProfilingLevelOptions = CommandOperationOptions
|
|
9
|
+
export type ProfilingLevelOptions = Omit<CommandOperationOptions, 'rawData'>;
|
|
10
10
|
|
|
11
11
|
class ProfilingLevelResponse extends MongoDBResponse {
|
|
12
12
|
get was() {
|
|
@@ -6,7 +6,7 @@ import { CommandOperation, type CommandOperationOptions } from './command';
|
|
|
6
6
|
import { Aspect, defineAspects } from './operation';
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
|
-
export type RemoveUserOptions = CommandOperationOptions
|
|
9
|
+
export type RemoveUserOptions = Omit<CommandOperationOptions, 'rawData'>;
|
|
10
10
|
|
|
11
11
|
/** @internal */
|
|
12
12
|
export class RemoveUserOperation extends CommandOperation<boolean> {
|
package/src/operations/rename.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { CommandOperation, type CommandOperationOptions } from './command';
|
|
|
8
8
|
import { Aspect, defineAspects } from './operation';
|
|
9
9
|
|
|
10
10
|
/** @public */
|
|
11
|
-
export interface RenameOptions extends CommandOperationOptions {
|
|
11
|
+
export interface RenameOptions extends Omit<CommandOperationOptions, 'rawData'> {
|
|
12
12
|
/** Drop the target name collection if it previously exists. */
|
|
13
13
|
dropTarget?: boolean;
|
|
14
14
|
/** Unclear */
|
|
@@ -19,7 +19,7 @@ export const ProfilingLevel = Object.freeze({
|
|
|
19
19
|
export type ProfilingLevel = (typeof ProfilingLevel)[keyof typeof ProfilingLevel];
|
|
20
20
|
|
|
21
21
|
/** @public */
|
|
22
|
-
export type SetProfilingLevelOptions = CommandOperationOptions
|
|
22
|
+
export type SetProfilingLevelOptions = Omit<CommandOperationOptions, 'rawData'>;
|
|
23
23
|
|
|
24
24
|
/** @internal */
|
|
25
25
|
export class SetProfilingLevelOperation extends CommandOperation<ProfilingLevel> {
|
package/src/operations/stats.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { CommandOperation, type CommandOperationOptions } from './command';
|
|
|
6
6
|
import { Aspect, defineAspects } from './operation';
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
|
-
export interface DbStatsOptions extends CommandOperationOptions {
|
|
9
|
+
export interface DbStatsOptions extends Omit<CommandOperationOptions, 'rawData'> {
|
|
10
10
|
/** Divide the returned sizes by scale value. */
|
|
11
11
|
scale?: number;
|
|
12
12
|
}
|
package/src/operations/update.ts
CHANGED
|
@@ -291,20 +291,28 @@ export function makeUpdateStatement(
|
|
|
291
291
|
return op;
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
defineAspects(UpdateOperation, [
|
|
294
|
+
defineAspects(UpdateOperation, [
|
|
295
|
+
Aspect.RETRYABLE,
|
|
296
|
+
Aspect.WRITE_OPERATION,
|
|
297
|
+
Aspect.SKIP_COLLATION,
|
|
298
|
+
Aspect.SUPPORTS_RAW_DATA
|
|
299
|
+
]);
|
|
295
300
|
defineAspects(UpdateOneOperation, [
|
|
296
301
|
Aspect.RETRYABLE,
|
|
297
302
|
Aspect.WRITE_OPERATION,
|
|
298
303
|
Aspect.EXPLAINABLE,
|
|
299
|
-
Aspect.SKIP_COLLATION
|
|
304
|
+
Aspect.SKIP_COLLATION,
|
|
305
|
+
Aspect.SUPPORTS_RAW_DATA
|
|
300
306
|
]);
|
|
301
307
|
defineAspects(UpdateManyOperation, [
|
|
302
308
|
Aspect.WRITE_OPERATION,
|
|
303
309
|
Aspect.EXPLAINABLE,
|
|
304
|
-
Aspect.SKIP_COLLATION
|
|
310
|
+
Aspect.SKIP_COLLATION,
|
|
311
|
+
Aspect.SUPPORTS_RAW_DATA
|
|
305
312
|
]);
|
|
306
313
|
defineAspects(ReplaceOneOperation, [
|
|
307
314
|
Aspect.RETRYABLE,
|
|
308
315
|
Aspect.WRITE_OPERATION,
|
|
309
|
-
Aspect.SKIP_COLLATION
|
|
316
|
+
Aspect.SKIP_COLLATION,
|
|
317
|
+
Aspect.SUPPORTS_RAW_DATA
|
|
310
318
|
]);
|
|
@@ -7,7 +7,7 @@ import type { ClientSession } from '../sessions';
|
|
|
7
7
|
import { CommandOperation, type CommandOperationOptions } from './command';
|
|
8
8
|
|
|
9
9
|
/** @public */
|
|
10
|
-
export interface ValidateCollectionOptions extends CommandOperationOptions {
|
|
10
|
+
export interface ValidateCollectionOptions extends Omit<CommandOperationOptions, 'rawData'> {
|
|
11
11
|
/** Validates a collection in the background, without interrupting read or write traffic (only in MongoDB 4.4+) */
|
|
12
12
|
background?: boolean;
|
|
13
13
|
}
|
package/src/utils.ts
CHANGED
|
@@ -359,34 +359,40 @@ export function uuidV4(): Buffer {
|
|
|
359
359
|
* A helper function for determining `maxWireVersion` between legacy and new topology instances
|
|
360
360
|
* @internal
|
|
361
361
|
*/
|
|
362
|
-
export function maxWireVersion(
|
|
363
|
-
if (
|
|
364
|
-
if (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
//
|
|
370
|
-
// We also return the max supported wire version for serverAPI.
|
|
362
|
+
export function maxWireVersion(handshakeAware?: Connection | Topology | Server): number {
|
|
363
|
+
if (handshakeAware) {
|
|
364
|
+
if (handshakeAware.hello) {
|
|
365
|
+
return handshakeAware.hello.maxWireVersion;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (handshakeAware.serverApi?.version) {
|
|
369
|
+
// We return the max supported wire version for serverAPI.
|
|
371
370
|
return MAX_SUPPORTED_WIRE_VERSION;
|
|
372
371
|
}
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
// This is the fallback case for load balanced mode. If we are building commands the
|
|
373
|
+
// object being checked will be a connection, and we will have a hello response on
|
|
374
|
+
// it. For other cases, such as retryable writes, the object will be a server or
|
|
375
|
+
// topology, and there will be no hello response on those objects, so we return
|
|
376
|
+
// the max wire version so we support retryability. Once we have a min supported
|
|
377
|
+
// wire version of 9, then the needsRetryableWriteLabel() check can remove the
|
|
378
|
+
// usage of passing the wire version into it.
|
|
379
|
+
if (handshakeAware.loadBalanced) {
|
|
380
|
+
return MAX_SUPPORTED_WIRE_VERSION;
|
|
375
381
|
}
|
|
376
382
|
|
|
377
|
-
if ('lastHello' in
|
|
378
|
-
const lastHello =
|
|
383
|
+
if ('lastHello' in handshakeAware && typeof handshakeAware.lastHello === 'function') {
|
|
384
|
+
const lastHello = handshakeAware.lastHello();
|
|
379
385
|
if (lastHello) {
|
|
380
386
|
return lastHello.maxWireVersion;
|
|
381
387
|
}
|
|
382
388
|
}
|
|
383
389
|
|
|
384
390
|
if (
|
|
385
|
-
|
|
386
|
-
'maxWireVersion' in
|
|
387
|
-
|
|
391
|
+
handshakeAware.description &&
|
|
392
|
+
'maxWireVersion' in handshakeAware.description &&
|
|
393
|
+
handshakeAware.description.maxWireVersion != null
|
|
388
394
|
) {
|
|
389
|
-
return
|
|
395
|
+
return handshakeAware.description.maxWireVersion;
|
|
390
396
|
}
|
|
391
397
|
}
|
|
392
398
|
|