mongodb 6.20.0-dev.20251007.sha.3f7196eb → 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.
Files changed (75) hide show
  1. package/lib/bulk/common.js +7 -9
  2. package/lib/bulk/common.js.map +1 -1
  3. package/lib/change_stream.js +5 -4
  4. package/lib/change_stream.js.map +1 -1
  5. package/lib/cmap/connection.js.map +1 -1
  6. package/lib/cmap/connection_pool.js.map +1 -1
  7. package/lib/cmap/handshake/client_metadata.js.map +1 -1
  8. package/lib/cmap/wire_protocol/constants.js +3 -1
  9. package/lib/cmap/wire_protocol/constants.js.map +1 -1
  10. package/lib/collection.js +1 -1
  11. package/lib/collection.js.map +1 -1
  12. package/lib/connection_string.js +0 -8
  13. package/lib/connection_string.js.map +1 -1
  14. package/lib/cursor/abstract_cursor.js +5 -4
  15. package/lib/cursor/abstract_cursor.js.map +1 -1
  16. package/lib/gridfs/download.js.map +1 -1
  17. package/lib/gridfs/upload.js +2 -8
  18. package/lib/gridfs/upload.js.map +1 -1
  19. package/lib/index.js +2 -4
  20. package/lib/index.js.map +1 -1
  21. package/lib/mongo_client.js +5 -4
  22. package/lib/mongo_client.js.map +1 -1
  23. package/lib/mongo_types.js +1 -2
  24. package/lib/mongo_types.js.map +1 -1
  25. package/lib/operations/aggregate.js +0 -3
  26. package/lib/operations/aggregate.js.map +1 -1
  27. package/lib/operations/command.js.map +1 -1
  28. package/lib/operations/create_collection.js +0 -1
  29. package/lib/operations/create_collection.js.map +1 -1
  30. package/lib/operations/execute_operation.js +3 -1
  31. package/lib/operations/execute_operation.js.map +1 -1
  32. package/lib/operations/find.js.map +1 -1
  33. package/lib/read_preference.js +0 -4
  34. package/lib/read_preference.js.map +1 -1
  35. package/lib/sdam/topology.js +1 -42
  36. package/lib/sdam/topology.js.map +1 -1
  37. package/lib/sessions.js +5 -4
  38. package/lib/sessions.js.map +1 -1
  39. package/lib/transactions.js +2 -13
  40. package/lib/transactions.js.map +1 -1
  41. package/lib/utils.js +0 -14
  42. package/lib/utils.js.map +1 -1
  43. package/mongodb.d.ts +31 -160
  44. package/package.json +2 -3
  45. package/src/bulk/common.ts +9 -11
  46. package/src/change_stream.ts +2 -24
  47. package/src/cmap/connection.ts +1 -0
  48. package/src/cmap/connection_pool.ts +0 -9
  49. package/src/cmap/handshake/client_metadata.ts +0 -13
  50. package/src/cmap/wire_protocol/constants.ts +2 -0
  51. package/src/collection.ts +1 -1
  52. package/src/connection_string.ts +0 -10
  53. package/src/cursor/abstract_cursor.ts +1 -7
  54. package/src/gridfs/download.ts +0 -4
  55. package/src/gridfs/upload.ts +0 -22
  56. package/src/index.ts +1 -6
  57. package/src/mongo_client.ts +1 -7
  58. package/src/mongo_types.ts +1 -2
  59. package/src/operations/aggregate.ts +0 -6
  60. package/src/operations/command.ts +0 -7
  61. package/src/operations/create_collection.ts +0 -3
  62. package/src/operations/execute_operation.ts +6 -2
  63. package/src/operations/find.ts +2 -11
  64. package/src/read_preference.ts +0 -9
  65. package/src/sdam/topology.ts +0 -53
  66. package/src/sessions.ts +2 -8
  67. package/src/transactions.ts +2 -17
  68. package/src/utils.ts +0 -18
  69. package/lib/beta.d.ts +0 -9224
  70. package/lib/beta.js +0 -21
  71. package/lib/beta.js.map +0 -1
  72. package/lib/resource_management.js +0 -58
  73. package/lib/resource_management.js.map +0 -1
  74. package/src/beta.ts +0 -22
  75. package/src/resource_management.ts +0 -74
@@ -17,9 +17,7 @@ import {
17
17
  import { MongoClient } from './mongo_client';
18
18
  import { type InferIdType, TypedEventEmitter } from './mongo_types';
19
19
  import type { AggregateOptions } from './operations/aggregate';
20
- import type { CollationOptions, OperationParent } from './operations/command';
21
- import type { ReadPreference } from './read_preference';
22
- import { type AsyncDisposable, configureResourceManagement } from './resource_management';
20
+ import type { OperationParent } from './operations/command';
23
21
  import type { ServerSessionId } from './sessions';
24
22
  import { CSOTTimeoutContext, type TimeoutContext } from './timeout';
25
23
  import { filterOptions, getTopology, type MongoDBNamespace, squashError } from './utils';
@@ -45,21 +43,6 @@ const NO_RESUME_TOKEN_ERROR =
45
43
  'A change stream document has been received that lacks a resume token (_id).';
46
44
  const CHANGESTREAM_CLOSED_ERROR = 'ChangeStream is closed';
47
45
 
48
- /**
49
- * @public
50
- * @deprecated Please use the ChangeStreamCursorOptions type instead.
51
- */
52
- export interface ResumeOptions {
53
- startAtOperationTime?: Timestamp;
54
- batchSize?: number;
55
- maxAwaitTimeMS?: number;
56
- collation?: CollationOptions;
57
- readPreference?: ReadPreference;
58
- resumeAfter?: ResumeToken;
59
- startAfter?: ResumeToken;
60
- fullDocument?: string;
61
- }
62
-
63
46
  /**
64
47
  * Represents the logical starting point for a new ChangeStream or resuming a ChangeStream on the server.
65
48
  * @see https://www.mongodb.com/docs/manual/changeStreams/#std-label-change-stream-resume
@@ -590,13 +573,10 @@ export class ChangeStream<
590
573
  implements AsyncDisposable
591
574
  {
592
575
  /**
593
- * @beta
594
576
  * @experimental
595
577
  * An alias for {@link ChangeStream.close|ChangeStream.close()}.
596
578
  */
597
- declare [Symbol.asyncDispose]: () => Promise<void>;
598
- /** @internal */
599
- async asyncDispose() {
579
+ async [Symbol.asyncDispose]() {
600
580
  await this.close();
601
581
  }
602
582
 
@@ -1106,5 +1086,3 @@ export class ChangeStream<
1106
1086
  }
1107
1087
  }
1108
1088
  }
1109
-
1110
- configureResourceManagement(ChangeStream.prototype);
@@ -138,6 +138,7 @@ export interface ConnectionOptions
138
138
  tls: boolean;
139
139
  noDelay?: boolean;
140
140
  socketTimeoutMS?: number;
141
+ /** @internal */
141
142
  cancellationToken?: CancellationToken;
142
143
  metadata: ClientMetadata;
143
144
  /** @internal */
@@ -97,15 +97,6 @@ export const PoolState = Object.freeze({
97
97
 
98
98
  type PoolState = (typeof PoolState)[keyof typeof PoolState];
99
99
 
100
- /**
101
- * @public
102
- * @deprecated This interface is deprecated and will be removed in a future release as it is not used
103
- * in the driver
104
- */
105
- export interface CloseOptions {
106
- force?: boolean;
107
- }
108
-
109
100
  /** @public */
110
101
  export type ConnectionPoolEvents = {
111
102
  connectionPoolCreated(event: ConnectionPoolCreatedEvent): void;
@@ -56,19 +56,6 @@ export interface ClientMetadata {
56
56
  };
57
57
  }
58
58
 
59
- /**
60
- * @public
61
- * @deprecated This interface will be made internal in the next major release.
62
- */
63
- export interface ClientMetadataOptions {
64
- driverInfo?: {
65
- name?: string;
66
- version?: string;
67
- platform?: string;
68
- };
69
- appName?: string;
70
- }
71
-
72
59
  /** @internal */
73
60
  export class LimitedSizeDocument {
74
61
  private document = new Map();
@@ -1,5 +1,7 @@
1
1
  export const MIN_SUPPORTED_SERVER_VERSION = '4.2';
2
2
  export const MAX_SUPPORTED_SERVER_VERSION = '8.2';
3
+ export const MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION = 13;
4
+ export const MIN_SUPPORTED_SNAPSHOT_READS_SERVER_VERSION = '5.0';
3
5
  export const MIN_SUPPORTED_WIRE_VERSION = 8;
4
6
  export const MAX_SUPPORTED_WIRE_VERSION = 27;
5
7
  export const MIN_SUPPORTED_QE_WIRE_VERSION = 21;
package/src/collection.ts CHANGED
@@ -546,7 +546,7 @@ export class Collection<TSchema extends Document = Document> {
546
546
  // Explicitly set the limit to 1 and singleBatch to true for all commands, per the spec.
547
547
  // noCursorTimeout must be unset as well as batchSize.
548
548
  // See: https://github.com/mongodb/specifications/blob/master/source/crud/crud.md#findone-api-details
549
- const { batchSize: _batchSize, noCursorTimeout: _noCursorTimeout, ...opts } = options;
549
+ const { ...opts } = options;
550
550
  opts.singleBatch = true;
551
551
  const cursor = this.find(filter, opts).limit(1);
552
552
  const result = await cursor.next();
@@ -1283,16 +1283,6 @@ export const OPTIONS = {
1283
1283
  secureProtocol: { type: 'any' },
1284
1284
  index: { type: 'any' },
1285
1285
  // Legacy options from v3 era
1286
- useNewUrlParser: {
1287
- type: 'boolean',
1288
- deprecated:
1289
- 'useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version'
1290
- } as OptionDescriptor,
1291
- useUnifiedTopology: {
1292
- type: 'boolean',
1293
- deprecated:
1294
- 'useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version'
1295
- } as OptionDescriptor,
1296
1286
  __skipPingOnConnect: { type: 'boolean' }
1297
1287
  } as Record<keyof MongoClientOptions, OptionDescriptor>;
1298
1288
 
@@ -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
@@ -53,10 +53,6 @@ export interface GridFSFile {
53
53
  filename: string;
54
54
  metadata?: Document;
55
55
  uploadDate: Date;
56
- /** @deprecated Will be removed in the next major version. */
57
- contentType?: string;
58
- /** @deprecated Will be removed in the next major version. */
59
- aliases?: string[];
60
56
  }
61
57
 
62
58
  /** @internal */
@@ -32,16 +32,6 @@ export interface GridFSBucketWriteStreamOptions extends WriteConcernOptions {
32
32
  id?: ObjectId;
33
33
  /** Object to store in the file document's `metadata` field */
34
34
  metadata?: Document;
35
- /**
36
- * String to store in the file document's `contentType` field.
37
- * @deprecated Will be removed in the next major version. Add a contentType field to the metadata document instead.
38
- */
39
- contentType?: string;
40
- /**
41
- * Array of strings to store in the file document's `aliases` field.
42
- * @deprecated Will be removed in the next major version. Add an aliases field to the metadata document instead.
43
- */
44
- aliases?: string[];
45
35
  /**
46
36
  * @experimental
47
37
  * Specifies the time an operation will run until it throws a timeout error
@@ -305,8 +295,6 @@ function checkDone(stream: GridFSBucketWriteStream, callback: Callback): void {
305
295
  stream.length,
306
296
  stream.chunkSizeBytes,
307
297
  stream.filename,
308
- stream.options.contentType,
309
- stream.options.aliases,
310
298
  stream.options.metadata
311
299
  );
312
300
 
@@ -402,8 +390,6 @@ function createFilesDoc(
402
390
  length: number,
403
391
  chunkSize: number,
404
392
  filename: string,
405
- contentType?: string,
406
- aliases?: string[],
407
393
  metadata?: Document
408
394
  ): GridFSFile {
409
395
  const ret: GridFSFile = {
@@ -414,14 +400,6 @@ function createFilesDoc(
414
400
  filename
415
401
  };
416
402
 
417
- if (contentType) {
418
- ret.contentType = contentType;
419
- }
420
-
421
- if (aliases) {
422
- ret.aliases = aliases;
423
- }
424
-
425
403
  if (metadata) {
426
404
  ret.metadata = metadata;
427
405
  }
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
@@ -224,7 +223,6 @@ export type {
224
223
  ChangeStreamSplitEvent,
225
224
  ChangeStreamUpdateDocument,
226
225
  OperationTime,
227
- ResumeOptions,
228
226
  ResumeToken,
229
227
  UpdateDescription
230
228
  } from './change_stream';
@@ -307,7 +305,6 @@ export type {
307
305
  ProxyOptions
308
306
  } from './cmap/connection';
309
307
  export type {
310
- CloseOptions,
311
308
  ConnectionPool,
312
309
  ConnectionPoolEvents,
313
310
  ConnectionPoolOptions,
@@ -315,7 +312,7 @@ export type {
315
312
  WaitQueueMember,
316
313
  WithConnectionCallback
317
314
  } from './cmap/connection_pool';
318
- export type { ClientMetadata, ClientMetadataOptions } from './cmap/handshake/client_metadata';
315
+ export type { ClientMetadata } from './cmap/handshake/client_metadata';
319
316
  export type { ConnectionPoolMetrics } from './cmap/metrics';
320
317
  export type { StreamDescription, StreamDescriptionOptions } from './cmap/stream_description';
321
318
  export type { CompressorName } from './cmap/wire_protocol/compression';
@@ -566,7 +563,6 @@ export type {
566
563
  ReadPreferenceLikeOptions,
567
564
  ReadPreferenceOptions
568
565
  } from './read_preference';
569
- export type { AsyncDisposable } from './resource_management';
570
566
  export type { ClusterTime } from './sdam/common';
571
567
  export type {
572
568
  Monitor,
@@ -598,7 +594,6 @@ export type { SrvPoller, SrvPollerEvents, SrvPollerOptions } from './sdam/srv_po
598
594
  export type {
599
595
  ConnectOptions,
600
596
  SelectServerOptions,
601
- ServerCapabilities,
602
597
  ServerSelectionCallback,
603
598
  ServerSelectionRequest,
604
599
  Topology,
@@ -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
  *
@@ -473,8 +473,7 @@ export class TypedEventEmitter<Events extends EventsDescription> extends EventEm
473
473
  }
474
474
 
475
475
  /**
476
- * @public
477
- * @deprecated Will be removed in favor of `AbortSignal` in the next major release.
476
+ * @internal
478
477
  */
479
478
  export class CancellationToken extends TypedEventEmitter<{ cancel(): void }> {
480
479
  constructor(...args: any[]) {
@@ -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
  }
@@ -53,13 +53,6 @@ export interface CommandOperationOptions
53
53
  * In server versions 4.4 and above, 'comment' can be any valid BSON type.
54
54
  */
55
55
  comment?: unknown;
56
- /**
57
- * @deprecated
58
- * This option is deprecated and will be removed in a future release as it is not used
59
- * in the driver. Use MongoClientOptions or connection string parameters instead.
60
- * */
61
- retryWrites?: boolean;
62
-
63
56
  // Admin command overrides.
64
57
  dbName?: string;
65
58
  authdb?: string;
@@ -23,7 +23,6 @@ const ILLEGAL_COMMAND_FIELDS = new Set([
23
23
  'timeoutMS',
24
24
  'j',
25
25
  'fsync',
26
- 'autoIndexId',
27
26
  'pkFactory',
28
27
  'raw',
29
28
  'readPreference',
@@ -68,8 +67,6 @@ export interface ClusteredCollectionOptions extends Document {
68
67
  export interface CreateCollectionOptions extends Omit<CommandOperationOptions, 'rawData'> {
69
68
  /** Create a capped collection */
70
69
  capped?: boolean;
71
- /** @deprecated Create an index on the _id field of the document. This option is deprecated in MongoDB 3.2+ and will be removed once no longer supported by the server. */
72
- autoIndexId?: boolean;
73
70
  /** The size of the capped collection in bytes */
74
71
  size?: number;
75
72
  /** The maximum number of documents in the capped collection */
@@ -1,3 +1,4 @@
1
+ import { MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION } from '../cmap/wire_protocol/constants';
1
2
  import {
2
3
  isRetryableReadError,
3
4
  isRetryableWriteError,
@@ -25,7 +26,7 @@ import {
25
26
  import type { Topology } from '../sdam/topology';
26
27
  import type { ClientSession } from '../sessions';
27
28
  import { TimeoutContext } from '../timeout';
28
- import { abortable, supportsRetryableWrites } from '../utils';
29
+ import { abortable, maxWireVersion, supportsRetryableWrites } from '../utils';
29
30
  import { AggregateOperation } from './aggregate';
30
31
  import { AbstractOperation, Aspect } from './operation';
31
32
 
@@ -81,7 +82,10 @@ export async function executeOperation<
81
82
  session = client.startSession({ owner, explicit: false });
82
83
  } else if (session.hasEnded) {
83
84
  throw new MongoExpiredSessionError('Use of expired sessions is not permitted');
84
- } else if (session.snapshotEnabled && !topology.capabilities.supportsSnapshotReads) {
85
+ } else if (
86
+ session.snapshotEnabled &&
87
+ maxWireVersion(topology) < MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION
88
+ ) {
85
89
  throw new MongoCompatibilityError('Snapshot reads require MongoDB 5.0 or later');
86
90
  } else if (session.client !== client) {
87
91
  throw new MongoInvalidArgumentError('ClientSession must be from the same MongoClient');
@@ -12,10 +12,8 @@ import { Aspect, defineAspects, type Hint } from './operation';
12
12
 
13
13
  /**
14
14
  * @public
15
- * @typeParam TSchema - Unused schema definition, deprecated usage, only specify `FindOptions` with no generic
16
15
  */
17
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
- export interface FindOptions<TSchema extends Document = Document>
16
+ export interface FindOptions
19
17
  extends Omit<CommandOperationOptions, 'writeConcern' | 'explain'>,
20
18
  AbstractCursorOptions {
21
19
  /** Sets the limit of documents returned in the query. */
@@ -76,14 +74,7 @@ export interface FindOptions<TSchema extends Document = Document>
76
74
  }
77
75
 
78
76
  /** @public */
79
- export interface FindOneOptions extends FindOptions {
80
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
81
- batchSize?: number;
82
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
83
- limit?: number;
84
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
85
- noCursorTimeout?: boolean;
86
- }
77
+ export type FindOneOptions = Omit<FindOptions, 'batchSize' | 'limit' | 'noCursorTimeout'>;
87
78
 
88
79
  /** @internal */
89
80
  export class FindOperation extends CommandOperation<CursorResponse> {
@@ -63,10 +63,6 @@ export class ReadPreference {
63
63
  tags?: TagSet[];
64
64
  hedge?: HedgeOptions;
65
65
  maxStalenessSeconds?: number;
66
- /**
67
- * @deprecated This will be removed as dead code in the next major version.
68
- */
69
- minWireVersion?: number;
70
66
 
71
67
  public static PRIMARY = ReadPreferenceMode.primary;
72
68
  public static PRIMARY_PREFERRED = ReadPreferenceMode.primaryPreferred;
@@ -100,7 +96,6 @@ export class ReadPreference {
100
96
  this.tags = tags;
101
97
  this.hedge = options?.hedge;
102
98
  this.maxStalenessSeconds = undefined;
103
- this.minWireVersion = undefined;
104
99
 
105
100
  options = options ?? {};
106
101
  if (options.maxStalenessSeconds != null) {
@@ -109,10 +104,6 @@ export class ReadPreference {
109
104
  }
110
105
 
111
106
  this.maxStalenessSeconds = options.maxStalenessSeconds;
112
-
113
- // NOTE: The minimum required wire version is 5 for this read preference. If the existing
114
- // topology has a lower value then a MongoError will be thrown during server selection.
115
- this.minWireVersion = 5;
116
107
  }
117
108
 
118
109
  if (this.mode === ReadPreference.PRIMARY) {
@@ -393,10 +393,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
393
393
  return this.s.options.serverApi;
394
394
  }
395
395
 
396
- get capabilities(): ServerCapabilities {
397
- return new ServerCapabilities(this.lastHello());
398
- }
399
-
400
396
  /** Initiate server connect */
401
397
  async connect(options?: ConnectOptions): Promise<Topology> {
402
398
  this.connectionLock ??= this._connect(options);
@@ -1103,52 +1099,3 @@ function isStaleServerDescription(
1103
1099
  compareTopologyVersion(currentTopologyVersion, incomingServerDescription.topologyVersion) > 0
1104
1100
  );
1105
1101
  }
1106
-
1107
- /**
1108
- * @public
1109
- * @deprecated This class will be removed as dead code in the next major version.
1110
- */
1111
- export class ServerCapabilities {
1112
- maxWireVersion: number;
1113
- minWireVersion: number;
1114
-
1115
- constructor(hello: Document) {
1116
- this.minWireVersion = hello.minWireVersion || 0;
1117
- this.maxWireVersion = hello.maxWireVersion || 0;
1118
- }
1119
-
1120
- get hasAggregationCursor(): boolean {
1121
- return true;
1122
- }
1123
-
1124
- get hasWriteCommands(): boolean {
1125
- return true;
1126
- }
1127
- get hasTextSearch(): boolean {
1128
- return true;
1129
- }
1130
-
1131
- get hasAuthCommands(): boolean {
1132
- return true;
1133
- }
1134
-
1135
- get hasListCollectionsCommand(): boolean {
1136
- return true;
1137
- }
1138
-
1139
- get hasListIndexesCommand(): boolean {
1140
- return true;
1141
- }
1142
-
1143
- get supportsSnapshotReads(): boolean {
1144
- return this.maxWireVersion >= 13;
1145
- }
1146
-
1147
- get commandsTakeWriteConcern(): boolean {
1148
- return true;
1149
- }
1150
-
1151
- get commandsTakeCollation(): boolean {
1152
- return true;
1153
- }
1154
- }
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 {
@@ -118,7 +117,7 @@ export class ClientSession
118
117
  /** @internal */
119
118
  owner?: symbol | AbstractCursor;
120
119
  defaultTransactionOptions: TransactionOptions;
121
- /** @deprecated - Will be made internal in the next major release */
120
+ /** @internal */
122
121
  transaction: Transaction;
123
122
  /**
124
123
  * @internal
@@ -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',
@@ -73,21 +73,15 @@ export interface TransactionOptions extends Omit<CommandOperationOptions, 'timeo
73
73
  }
74
74
 
75
75
  /**
76
- * @public
77
- * @deprecated - Will be made internal in a future major release.
78
- * A class maintaining state related to a server transaction. Internal Only
76
+ * @internal
79
77
  */
80
78
  export class Transaction {
81
- /** @internal */
82
79
  state: TxnState;
83
- /** @deprecated - Will be made internal in a future major release. */
84
80
  options: TransactionOptions;
85
- /** @internal */
86
81
  _pinnedServer?: Server;
87
- /** @internal */
88
82
  _recoveryToken?: Document;
89
83
 
90
- /** Create a transaction @internal */
84
+ /** Create a transaction */
91
85
  constructor(options?: TransactionOptions) {
92
86
  options = options ?? {};
93
87
  this.state = TxnState.NO_TRANSACTION;
@@ -119,23 +113,19 @@ export class Transaction {
119
113
  this._recoveryToken = undefined;
120
114
  }
121
115
 
122
- /** @internal */
123
116
  get server(): Server | undefined {
124
117
  return this._pinnedServer;
125
118
  }
126
119
 
127
- /** @deprecated - Will be made internal in a future major release. */
128
120
  get recoveryToken(): Document | undefined {
129
121
  return this._recoveryToken;
130
122
  }
131
123
 
132
- /** @deprecated - Will be made internal in a future major release. */
133
124
  get isPinned(): boolean {
134
125
  return !!this.server;
135
126
  }
136
127
 
137
128
  /**
138
- * @deprecated - Will be made internal in a future major release.
139
129
  * @returns Whether the transaction has started
140
130
  */
141
131
  get isStarting(): boolean {
@@ -143,20 +133,17 @@ export class Transaction {
143
133
  }
144
134
 
145
135
  /**
146
- * @deprecated - Will be made internal in a future major release.
147
136
  * @returns Whether this session is presently in a transaction
148
137
  */
149
138
  get isActive(): boolean {
150
139
  return ACTIVE_STATES.has(this.state);
151
140
  }
152
141
 
153
- /** @deprecated - Will be made internal in a future major release. */
154
142
  get isCommitted(): boolean {
155
143
  return COMMITTED_STATES.has(this.state);
156
144
  }
157
145
  /**
158
146
  * Transition the transaction in the state machine
159
- * @internal
160
147
  * @param nextState - The new state to transition to
161
148
  */
162
149
  transition(nextState: TxnState): void {
@@ -178,14 +165,12 @@ export class Transaction {
178
165
  );
179
166
  }
180
167
 
181
- /** @internal */
182
168
  pinServer(server: Server): void {
183
169
  if (this.isActive) {
184
170
  this._pinnedServer = server;
185
171
  }
186
172
  }
187
173
 
188
- /** @internal */
189
174
  unpinServer(): void {
190
175
  this._pinnedServer = undefined;
191
176
  }
package/src/utils.ts CHANGED
@@ -153,24 +153,6 @@ export function filterOptions(options: AnyOptions, names: ReadonlyArray<string>)
153
153
  return filterOptions;
154
154
  }
155
155
 
156
- interface HasRetryableWrites {
157
- retryWrites?: boolean;
158
- }
159
- /**
160
- * Applies retryWrites: true to a command if retryWrites is set on the command's database.
161
- * @internal
162
- *
163
- * @param target - The target command to which we will apply retryWrites.
164
- * @param db - The database from which we can inherit a retryWrites value.
165
- */
166
- export function applyRetryableWrites<T extends HasRetryableWrites>(target: T, db?: Db): T {
167
- if (db && db.s.options?.retryWrites) {
168
- target.retryWrites = true;
169
- }
170
-
171
- return target;
172
- }
173
-
174
156
  /**
175
157
  * Applies a write concern to a command based on well defined inheritance rules, optionally
176
158
  * detecting support for the write concern in the first place.