mongodb 6.20.0-dev.20251008.sha.cfbada66 → 6.20.0-dev.20251009.sha.fb2824ff

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/mongodb.d.ts CHANGED
@@ -69,7 +69,7 @@ export declare type Abortable = {
69
69
  };
70
70
 
71
71
  /** @public */
72
- export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> implements AsyncDisposable_2 {
72
+ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends AbstractCursorEvents = AbstractCursorEvents> extends TypedEventEmitter<CursorEvents> implements AsyncDisposable {
73
73
  /* Excluded from this release type: cursorId */
74
74
  /* Excluded from this release type: cursorSession */
75
75
  /* Excluded from this release type: selectedServer */
@@ -114,8 +114,11 @@ export declare abstract class AbstractCursor<TSchema = any, CursorEvents extends
114
114
  */
115
115
  get killed(): boolean;
116
116
  get loadBalanced(): boolean;
117
- /* Excluded from this release type: [Symbol.asyncDispose] */
118
- /* Excluded from this release type: asyncDispose */
117
+ /**
118
+ * @experimental
119
+ * An alias for {@link AbstractCursor.close|AbstractCursor.close()}.
120
+ */
121
+ [Symbol.asyncDispose](): Promise<void>;
119
122
  /** Adds cursor to client's tracking so it will be closed by MongoClient.close() */
120
123
  private trackCursor;
121
124
  /** Returns current buffered documents length */
@@ -628,15 +631,6 @@ export declare type ArrayOperator<Type> = {
628
631
  $sort?: Sort;
629
632
  };
630
633
 
631
- /**
632
- * @public
633
- */
634
- declare interface AsyncDisposable_2 {
635
- /* Excluded from this release type: [Symbol.asyncDispose] */
636
- /* Excluded from this release type: asyncDispose */
637
- }
638
- export { AsyncDisposable_2 as AsyncDisposable }
639
-
640
634
  /** @public */
641
635
  export declare interface Auth {
642
636
  /** The username for auth */
@@ -1171,9 +1165,12 @@ export declare type Callback<T = any> = (error?: AnyError, result?: T) => void;
1171
1165
  * Creates a new Change Stream instance. Normally created using {@link Collection#watch|Collection.watch()}.
1172
1166
  * @public
1173
1167
  */
1174
- export declare class ChangeStream<TSchema extends Document = Document, TChange extends Document = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> implements AsyncDisposable_2 {
1175
- /* Excluded from this release type: [Symbol.asyncDispose] */
1176
- /* Excluded from this release type: asyncDispose */
1168
+ export declare class ChangeStream<TSchema extends Document = Document, TChange extends Document = ChangeStreamDocument<TSchema>> extends TypedEventEmitter<ChangeStreamEvents<TSchema, TChange>> implements AsyncDisposable {
1169
+ /**
1170
+ * @experimental
1171
+ * An alias for {@link ChangeStream.close|ChangeStream.close()}.
1172
+ */
1173
+ [Symbol.asyncDispose](): Promise<void>;
1177
1174
  pipeline: Document[];
1178
1175
  /**
1179
1176
  * @remarks WriteConcern can still be present on the options because
@@ -2328,7 +2325,7 @@ export declare interface ClientReplaceOneModel<TSchema> extends ClientWriteModel
2328
2325
  * NOTE: not meant to be instantiated directly.
2329
2326
  * @public
2330
2327
  */
2331
- export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> implements AsyncDisposable_2 {
2328
+ export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents> implements AsyncDisposable {
2332
2329
  /* Excluded from this release type: client */
2333
2330
  /* Excluded from this release type: sessionPool */
2334
2331
  hasEnded: boolean;
@@ -2371,8 +2368,11 @@ export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents
2371
2368
  * @param options - Optional settings. Currently reserved for future use
2372
2369
  */
2373
2370
  endSession(options?: EndSessionOptions): Promise<void>;
2374
- /* Excluded from this release type: [Symbol.asyncDispose] */
2375
- /* Excluded from this release type: asyncDispose */
2371
+ /**
2372
+ * @experimental
2373
+ * An alias for {@link ClientSession.endSession|ClientSession.endSession()}.
2374
+ */
2375
+ [Symbol.asyncDispose](): Promise<void>;
2376
2376
  /**
2377
2377
  * Advances the operationTime for a ClientSession.
2378
2378
  *
@@ -3405,8 +3405,6 @@ export declare type CompressorName = keyof typeof Compressor;
3405
3405
  /** @public */
3406
3406
  export declare type Condition<T> = AlternativeType<T> | FilterOperators<AlternativeType<T>>;
3407
3407
 
3408
- /* Excluded from this release type: configureExplicitResourceManagement */
3409
-
3410
3408
  /* Excluded from this release type: Connection */
3411
3409
 
3412
3410
  /* Excluded from this release type: CONNECTION_CHECK_OUT_FAILED */
@@ -5716,7 +5714,7 @@ export declare class MongoChangeStreamError extends MongoRuntimeError {
5716
5714
  * const client = new MongoClient('mongodb://localhost:27017?appName=mflix', { monitorCommands: true });
5717
5715
  * ```
5718
5716
  */
5719
- export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implements AsyncDisposable_2 {
5717
+ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> implements AsyncDisposable {
5720
5718
  /* Excluded from this release type: s */
5721
5719
  /* Excluded from this release type: topology */
5722
5720
  /* Excluded from this release type: mongoLogger */
@@ -5728,8 +5726,11 @@ export declare class MongoClient extends TypedEventEmitter<MongoClientEvents> im
5728
5726
  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'>;
5729
5727
  private driverInfoList;
5730
5728
  constructor(url: string, options?: MongoClientOptions);
5731
- /* Excluded from this release type: [Symbol.asyncDispose] */
5732
- /* Excluded from this release type: asyncDispose */
5729
+ /**
5730
+ * @experimental
5731
+ * An alias for {@link MongoClient.close|MongoClient.close()}.
5732
+ */
5733
+ [Symbol.asyncDispose](): Promise<void>;
5733
5734
  /**
5734
5735
  * Append metadata to the client metadata after instantiation.
5735
5736
  * @param driverInfo - Information about the application or library.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb",
3
- "version": "6.20.0-dev.20251008.sha.cfbada66",
3
+ "version": "6.20.0-dev.20251009.sha.fb2824ff",
4
4
  "description": "The official MongoDB driver for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -124,7 +124,7 @@
124
124
  "scripts": {
125
125
  "build:evergreen": "node .evergreen/generate_evergreen_tasks.js",
126
126
  "build:ts": "node ./node_modules/typescript/bin/tsc",
127
- "build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs && ESLINT_USE_FLAT_CONFIG=false eslint --no-ignore --fix mongodb.d.ts lib/beta.d.ts",
127
+ "build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs && ESLINT_USE_FLAT_CONFIG=false eslint --no-ignore --fix mongodb.d.ts",
128
128
  "build:docs": "./etc/docs/build.ts",
129
129
  "build:typedoc": "typedoc",
130
130
  "build:nightly": "node ./.github/scripts/nightly.mjs",
@@ -143,7 +143,6 @@
143
143
  "check:unit": "nyc mocha test/unit",
144
144
  "check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit",
145
145
  "check:atlas": "nyc mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts",
146
- "check:resource-management": "nyc mocha --config test/manual/mocharc.js test/manual/resource_management.test.ts",
147
146
  "check:drivers-atlas-testing": "nyc mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts",
148
147
  "check:aws": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_aws.test.ts",
149
148
  "check:oidc-auth": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts",
@@ -18,7 +18,6 @@ import { MongoClient } from './mongo_client';
18
18
  import { type InferIdType, TypedEventEmitter } from './mongo_types';
19
19
  import type { AggregateOptions } from './operations/aggregate';
20
20
  import type { OperationParent } from './operations/command';
21
- import { type AsyncDisposable, configureResourceManagement } from './resource_management';
22
21
  import type { ServerSessionId } from './sessions';
23
22
  import { CSOTTimeoutContext, type TimeoutContext } from './timeout';
24
23
  import { filterOptions, getTopology, type MongoDBNamespace, squashError } from './utils';
@@ -574,13 +573,10 @@ export class ChangeStream<
574
573
  implements AsyncDisposable
575
574
  {
576
575
  /**
577
- * @beta
578
576
  * @experimental
579
577
  * An alias for {@link ChangeStream.close|ChangeStream.close()}.
580
578
  */
581
- declare [Symbol.asyncDispose]: () => Promise<void>;
582
- /** @internal */
583
- async asyncDispose() {
579
+ async [Symbol.asyncDispose]() {
584
580
  await this.close();
585
581
  }
586
582
 
@@ -1090,5 +1086,3 @@ export class ChangeStream<
1090
1086
  }
1091
1087
  }
1092
1088
  }
1093
-
1094
- configureResourceManagement(ChangeStream.prototype);
@@ -18,7 +18,6 @@ import { GetMoreOperation } from '../operations/get_more';
18
18
  import { KillCursorsOperation } from '../operations/kill_cursors';
19
19
  import { ReadConcern, type ReadConcernLike } from '../read_concern';
20
20
  import { ReadPreference, type ReadPreferenceLike } from '../read_preference';
21
- import { type AsyncDisposable, configureResourceManagement } from '../resource_management';
22
21
  import type { Server } from '../sdam/server';
23
22
  import { type ClientSession, maybeClearPinnedConnection } from '../sessions';
24
23
  import { type CSOTTimeoutContext, type Timeout, TimeoutContext } from '../timeout';
@@ -437,13 +436,10 @@ export abstract class AbstractCursor<
437
436
  }
438
437
 
439
438
  /**
440
- * @beta
441
439
  * @experimental
442
440
  * An alias for {@link AbstractCursor.close|AbstractCursor.close()}.
443
441
  */
444
- declare [Symbol.asyncDispose]: () => Promise<void>;
445
- /** @internal */
446
- async asyncDispose() {
442
+ async [Symbol.asyncDispose]() {
447
443
  await this.close();
448
444
  }
449
445
 
@@ -1223,8 +1219,6 @@ class ReadableCursorStream extends Readable {
1223
1219
  }
1224
1220
  }
1225
1221
 
1226
- configureResourceManagement(AbstractCursor.prototype);
1227
-
1228
1222
  /**
1229
1223
  * @internal
1230
1224
  * The cursor timeout context is a wrapper around a timeout context
package/src/index.ts CHANGED
@@ -87,7 +87,6 @@ export {
87
87
  MongoWriteConcernError,
88
88
  WriteConcernErrorResult
89
89
  } from './error';
90
- export { configureExplicitResourceManagement } from './resource_management';
91
90
  export {
92
91
  AbstractCursor,
93
92
  // Actual driver classes exported
@@ -564,7 +563,6 @@ export type {
564
563
  ReadPreferenceLikeOptions,
565
564
  ReadPreferenceOptions
566
565
  } from './read_preference';
567
- export type { AsyncDisposable } from './resource_management';
568
566
  export type { ClusterTime } from './sdam/common';
569
567
  export type {
570
568
  Monitor,
@@ -48,7 +48,6 @@ import { executeOperation } from './operations/execute_operation';
48
48
  import { AbstractOperation } from './operations/operation';
49
49
  import type { ReadConcern, ReadConcernLevel, ReadConcernLike } from './read_concern';
50
50
  import { ReadPreference, type ReadPreferenceMode } from './read_preference';
51
- import { type AsyncDisposable, configureResourceManagement } from './resource_management';
52
51
  import type { ServerMonitoringMode } from './sdam/monitor';
53
52
  import type { TagSet } from './sdam/server_description';
54
53
  import { readPreferenceServerSelector } from './sdam/server_selection';
@@ -485,13 +484,10 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
485
484
  }
486
485
 
487
486
  /**
488
- * @beta
489
487
  * @experimental
490
488
  * An alias for {@link MongoClient.close|MongoClient.close()}.
491
489
  */
492
- declare [Symbol.asyncDispose]: () => Promise<void>;
493
- /** @internal */
494
- async asyncDispose() {
490
+ async [Symbol.asyncDispose]() {
495
491
  await this.close();
496
492
  }
497
493
 
@@ -1037,8 +1033,6 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
1037
1033
  }
1038
1034
  }
1039
1035
 
1040
- configureResourceManagement(MongoClient.prototype);
1041
-
1042
1036
  /**
1043
1037
  * Parsed Mongo Client Options.
1044
1038
  *
@@ -80,12 +80,6 @@ export class AggregateOperation extends CommandOperation<CursorResponse> {
80
80
  delete this.options.writeConcern;
81
81
  }
82
82
 
83
- if (this.explain && this.writeConcern) {
84
- throw new MongoInvalidArgumentError(
85
- 'Option "explain" cannot be used on an aggregate call with writeConcern'
86
- );
87
- }
88
-
89
83
  if (options?.cursor != null && typeof options.cursor !== 'object') {
90
84
  throw new MongoInvalidArgumentError('Cursor options must be an object');
91
85
  }
package/src/sessions.ts CHANGED
@@ -26,7 +26,6 @@ import { executeOperation } from './operations/execute_operation';
26
26
  import { RunCommandOperation } from './operations/run_command';
27
27
  import { ReadConcernLevel } from './read_concern';
28
28
  import { ReadPreference } from './read_preference';
29
- import { type AsyncDisposable, configureResourceManagement } from './resource_management';
30
29
  import { _advanceClusterTime, type ClusterTime, TopologyType } from './sdam/common';
31
30
  import { TimeoutContext } from './timeout';
32
31
  import {
@@ -289,13 +288,10 @@ export class ClientSession
289
288
  }
290
289
  }
291
290
  /**
292
- * @beta
293
291
  * @experimental
294
292
  * An alias for {@link ClientSession.endSession|ClientSession.endSession()}.
295
293
  */
296
- declare [Symbol.asyncDispose]: () => Promise<void>;
297
- /** @internal */
298
- async asyncDispose() {
294
+ async [Symbol.asyncDispose]() {
299
295
  await this.endSession({ force: true });
300
296
  }
301
297
 
@@ -823,8 +819,6 @@ export class ClientSession
823
819
  }
824
820
  }
825
821
 
826
- configureResourceManagement(ClientSession.prototype);
827
-
828
822
  const NON_DETERMINISTIC_WRITE_CONCERN_ERRORS = new Set([
829
823
  'CannotSatisfyWriteConcern',
830
824
  'UnknownReplWriteConcern',