mongodb 6.20.0-dev.20251007.sha.3f7196eb → 6.20.0-dev.20251008.sha.cfbada66

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 (56) hide show
  1. package/lib/beta.d.ts +7 -137
  2. package/lib/bulk/common.js +7 -9
  3. package/lib/bulk/common.js.map +1 -1
  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/gridfs/download.js.map +1 -1
  15. package/lib/gridfs/upload.js +2 -8
  16. package/lib/gridfs/upload.js.map +1 -1
  17. package/lib/index.js.map +1 -1
  18. package/lib/mongo_types.js +1 -2
  19. package/lib/mongo_types.js.map +1 -1
  20. package/lib/operations/command.js.map +1 -1
  21. package/lib/operations/create_collection.js +0 -1
  22. package/lib/operations/create_collection.js.map +1 -1
  23. package/lib/operations/execute_operation.js +3 -1
  24. package/lib/operations/execute_operation.js.map +1 -1
  25. package/lib/operations/find.js.map +1 -1
  26. package/lib/read_preference.js +0 -4
  27. package/lib/read_preference.js.map +1 -1
  28. package/lib/sdam/topology.js +1 -42
  29. package/lib/sdam/topology.js.map +1 -1
  30. package/lib/transactions.js +2 -13
  31. package/lib/transactions.js.map +1 -1
  32. package/lib/utils.js +0 -14
  33. package/lib/utils.js.map +1 -1
  34. package/mongodb.d.ts +7 -137
  35. package/package.json +1 -1
  36. package/src/bulk/common.ts +9 -11
  37. package/src/change_stream.ts +1 -17
  38. package/src/cmap/connection.ts +1 -0
  39. package/src/cmap/connection_pool.ts +0 -9
  40. package/src/cmap/handshake/client_metadata.ts +0 -13
  41. package/src/cmap/wire_protocol/constants.ts +2 -0
  42. package/src/collection.ts +1 -1
  43. package/src/connection_string.ts +0 -10
  44. package/src/gridfs/download.ts +0 -4
  45. package/src/gridfs/upload.ts +0 -22
  46. package/src/index.ts +1 -4
  47. package/src/mongo_types.ts +1 -2
  48. package/src/operations/command.ts +0 -7
  49. package/src/operations/create_collection.ts +0 -3
  50. package/src/operations/execute_operation.ts +6 -2
  51. package/src/operations/find.ts +2 -11
  52. package/src/read_preference.ts +0 -9
  53. package/src/sdam/topology.ts +0 -53
  54. package/src/sessions.ts +1 -1
  55. package/src/transactions.ts +2 -17
  56. package/src/utils.ts +0 -18
package/mongodb.d.ts CHANGED
@@ -1010,6 +1010,7 @@ export declare abstract class BulkOperationBase {
1010
1010
  /* Excluded from this release type: s */
1011
1011
  operationId?: number;
1012
1012
  private collection;
1013
+ /* Excluded from this release type: retryWrites */
1013
1014
  /* Excluded from this release type: __constructor */
1014
1015
  /**
1015
1016
  * Add a single insert document to the bulk operation
@@ -1164,15 +1165,7 @@ export declare class BulkWriteResult {
1164
1165
  */
1165
1166
  export declare type Callback<T = any> = (error?: AnyError, result?: T) => void;
1166
1167
 
1167
- /**
1168
- * @public
1169
- * @deprecated Will be removed in favor of `AbortSignal` in the next major release.
1170
- */
1171
- export declare class CancellationToken extends TypedEventEmitter<{
1172
- cancel(): void;
1173
- }> {
1174
- constructor(...args: any[]);
1175
- }
1168
+ /* Excluded from this release type: CancellationToken */
1176
1169
 
1177
1170
  /**
1178
1171
  * Creates a new Change Stream instance. Normally created using {@link Collection#watch|Collection.watch()}.
@@ -2309,19 +2302,6 @@ export declare interface ClientMetadata {
2309
2302
  };
2310
2303
  }
2311
2304
 
2312
- /**
2313
- * @public
2314
- * @deprecated This interface will be made internal in the next major release.
2315
- */
2316
- export declare interface ClientMetadataOptions {
2317
- driverInfo?: {
2318
- name?: string;
2319
- version?: string;
2320
- platform?: string;
2321
- };
2322
- appName?: string;
2323
- }
2324
-
2325
2305
  /** @public */
2326
2306
  export declare interface ClientReplaceOneModel<TSchema> extends ClientWriteModel {
2327
2307
  name: 'replaceOne';
@@ -2361,8 +2341,7 @@ export declare class ClientSession extends TypedEventEmitter<ClientSessionEvents
2361
2341
  explicit: boolean;
2362
2342
  /* Excluded from this release type: owner */
2363
2343
  defaultTransactionOptions: TransactionOptions;
2364
- /** @deprecated - Will be made internal in the next major release */
2365
- transaction: Transaction;
2344
+ /* Excluded from this release type: transaction */
2366
2345
  /* Excluded from this release type: commitAttempted */
2367
2346
  readonly snapshotEnabled: boolean;
2368
2347
  /* Excluded from this release type: _serverSession */
@@ -2614,15 +2593,6 @@ export declare interface ClientWriteModel {
2614
2593
  namespace: string;
2615
2594
  }
2616
2595
 
2617
- /**
2618
- * @public
2619
- * @deprecated This interface is deprecated and will be removed in a future release as it is not used
2620
- * in the driver
2621
- */
2622
- export declare interface CloseOptions {
2623
- force?: boolean;
2624
- }
2625
-
2626
2596
  /** @public
2627
2597
  * Configuration options for clustered collections
2628
2598
  * @see https://www.mongodb.com/docs/manual/core/clustered-collections/
@@ -3352,12 +3322,6 @@ export declare interface CommandOperationOptions extends OperationOptions, Write
3352
3322
  * In server versions 4.4 and above, 'comment' can be any valid BSON type.
3353
3323
  */
3354
3324
  comment?: unknown;
3355
- /**
3356
- * @deprecated
3357
- * This option is deprecated and will be removed in a future release as it is not used
3358
- * in the driver. Use MongoClientOptions or connection string parameters instead.
3359
- * */
3360
- retryWrites?: boolean;
3361
3325
  dbName?: string;
3362
3326
  authdb?: string;
3363
3327
  /**
@@ -3583,7 +3547,7 @@ export declare interface ConnectionOptions extends SupportedNodeConnectionOption
3583
3547
  tls: boolean;
3584
3548
  noDelay?: boolean;
3585
3549
  socketTimeoutMS?: number;
3586
- cancellationToken?: CancellationToken;
3550
+ /* Excluded from this release type: cancellationToken */
3587
3551
  metadata: ClientMetadata;
3588
3552
  /* Excluded from this release type: extendedMetadata */
3589
3553
  /* Excluded from this release type: mongoLogger */
@@ -3738,8 +3702,6 @@ export declare interface CountOptions extends CommandOperationOptions {
3738
3702
  export declare interface CreateCollectionOptions extends Omit<CommandOperationOptions, 'rawData'> {
3739
3703
  /** Create a capped collection */
3740
3704
  capped?: boolean;
3741
- /** @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. */
3742
- autoIndexId?: boolean;
3743
3705
  /** The size of the capped collection in bytes */
3744
3706
  size?: number;
3745
3707
  /** The maximum number of documents in the capped collection */
@@ -4731,14 +4693,7 @@ export declare interface FindOneAndUpdateOptions extends CommandOperationOptions
4731
4693
  }
4732
4694
 
4733
4695
  /** @public */
4734
- export declare interface FindOneOptions extends FindOptions {
4735
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
4736
- batchSize?: number;
4737
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
4738
- limit?: number;
4739
- /** @deprecated Will be removed in the next major version. User provided value will be ignored. */
4740
- noCursorTimeout?: boolean;
4741
- }
4696
+ export declare type FindOneOptions = Omit<FindOptions, 'batchSize' | 'limit' | 'noCursorTimeout'>;
4742
4697
 
4743
4698
  /**
4744
4699
  * A builder object that is returned from {@link BulkOperationBase#find}.
@@ -4771,9 +4726,8 @@ export declare class FindOperators {
4771
4726
 
4772
4727
  /**
4773
4728
  * @public
4774
- * @typeParam TSchema - Unused schema definition, deprecated usage, only specify `FindOptions` with no generic
4775
4729
  */
4776
- export declare interface FindOptions<TSchema extends Document = Document> extends Omit<CommandOperationOptions, 'writeConcern' | 'explain'>, AbstractCursorOptions {
4730
+ export declare interface FindOptions extends Omit<CommandOperationOptions, 'writeConcern' | 'explain'>, AbstractCursorOptions {
4777
4731
  /** Sets the limit of documents returned in the query. */
4778
4732
  limit?: number;
4779
4733
  /** Set to sort the documents coming back from the query. Array of indexes, `[['a', 1]]` etc. */
@@ -5124,16 +5078,6 @@ export declare interface GridFSBucketWriteStreamOptions extends WriteConcernOpti
5124
5078
  id?: ObjectId;
5125
5079
  /** Object to store in the file document's `metadata` field */
5126
5080
  metadata?: Document;
5127
- /**
5128
- * String to store in the file document's `contentType` field.
5129
- * @deprecated Will be removed in the next major version. Add a contentType field to the metadata document instead.
5130
- */
5131
- contentType?: string;
5132
- /**
5133
- * Array of strings to store in the file document's `aliases` field.
5134
- * @deprecated Will be removed in the next major version. Add an aliases field to the metadata document instead.
5135
- */
5136
- aliases?: string[];
5137
5081
  /**
5138
5082
  * @experimental
5139
5083
  * Specifies the time an operation will run until it throws a timeout error
@@ -5157,10 +5101,6 @@ export declare interface GridFSFile {
5157
5101
  filename: string;
5158
5102
  metadata?: Document;
5159
5103
  uploadDate: Date;
5160
- /** @deprecated Will be removed in the next major version. */
5161
- contentType?: string;
5162
- /** @deprecated Will be removed in the next major version. */
5163
- aliases?: string[];
5164
5104
  }
5165
5105
 
5166
5106
  /** @public */
@@ -7725,10 +7665,6 @@ export declare class ReadPreference {
7725
7665
  tags?: TagSet[];
7726
7666
  hedge?: HedgeOptions;
7727
7667
  maxStalenessSeconds?: number;
7728
- /**
7729
- * @deprecated This will be removed as dead code in the next major version.
7730
- */
7731
- minWireVersion?: number;
7732
7668
  static PRIMARY: "primary";
7733
7669
  static PRIMARY_PREFERRED: "primaryPreferred";
7734
7670
  static SECONDARY: "secondary";
@@ -7870,21 +7806,6 @@ export declare interface ReplaceOptions extends CommandOperationOptions {
7870
7806
  sort?: Sort;
7871
7807
  }
7872
7808
 
7873
- /**
7874
- * @public
7875
- * @deprecated Please use the ChangeStreamCursorOptions type instead.
7876
- */
7877
- export declare interface ResumeOptions {
7878
- startAtOperationTime?: Timestamp;
7879
- batchSize?: number;
7880
- maxAwaitTimeMS?: number;
7881
- collation?: CollationOptions;
7882
- readPreference?: ReadPreference;
7883
- resumeAfter?: ResumeToken;
7884
- startAfter?: ResumeToken;
7885
- fullDocument?: string;
7886
- }
7887
-
7888
7809
  /**
7889
7810
  * Represents the logical starting point for a new ChangeStream or resuming a ChangeStream on the server.
7890
7811
  * @see https://www.mongodb.com/docs/manual/changeStreams/#std-label-change-stream-resume
@@ -8090,25 +8011,6 @@ export declare const ServerApiVersion: Readonly<{
8090
8011
  /** @public */
8091
8012
  export declare type ServerApiVersion = (typeof ServerApiVersion)[keyof typeof ServerApiVersion];
8092
8013
 
8093
- /**
8094
- * @public
8095
- * @deprecated This class will be removed as dead code in the next major version.
8096
- */
8097
- export declare class ServerCapabilities {
8098
- maxWireVersion: number;
8099
- minWireVersion: number;
8100
- constructor(hello: Document);
8101
- get hasAggregationCursor(): boolean;
8102
- get hasWriteCommands(): boolean;
8103
- get hasTextSearch(): boolean;
8104
- get hasAuthCommands(): boolean;
8105
- get hasListCollectionsCommand(): boolean;
8106
- get hasListIndexesCommand(): boolean;
8107
- get supportsSnapshotReads(): boolean;
8108
- get commandsTakeWriteConcern(): boolean;
8109
- get commandsTakeCollation(): boolean;
8110
- }
8111
-
8112
8014
  /**
8113
8015
  * Emitted when server is closed.
8114
8016
  * @public
@@ -8711,39 +8613,7 @@ export declare interface TopologyVersion {
8711
8613
  counter: Long;
8712
8614
  }
8713
8615
 
8714
- /**
8715
- * @public
8716
- * @deprecated - Will be made internal in a future major release.
8717
- * A class maintaining state related to a server transaction. Internal Only
8718
- */
8719
- export declare class Transaction {
8720
- /* Excluded from this release type: state */
8721
- /** @deprecated - Will be made internal in a future major release. */
8722
- options: TransactionOptions;
8723
- /* Excluded from this release type: _pinnedServer */
8724
- /* Excluded from this release type: _recoveryToken */
8725
- /* Excluded from this release type: __constructor */
8726
- /* Excluded from this release type: server */
8727
- /** @deprecated - Will be made internal in a future major release. */
8728
- get recoveryToken(): Document | undefined;
8729
- /** @deprecated - Will be made internal in a future major release. */
8730
- get isPinned(): boolean;
8731
- /**
8732
- * @deprecated - Will be made internal in a future major release.
8733
- * @returns Whether the transaction has started
8734
- */
8735
- get isStarting(): boolean;
8736
- /**
8737
- * @deprecated - Will be made internal in a future major release.
8738
- * @returns Whether this session is presently in a transaction
8739
- */
8740
- get isActive(): boolean;
8741
- /** @deprecated - Will be made internal in a future major release. */
8742
- get isCommitted(): boolean;
8743
- /* Excluded from this release type: transition */
8744
- /* Excluded from this release type: pinServer */
8745
- /* Excluded from this release type: unpinServer */
8746
- }
8616
+ /* Excluded from this release type: Transaction */
8747
8617
 
8748
8618
  /**
8749
8619
  * Configuration options for a transaction.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb",
3
- "version": "6.20.0-dev.20251007.sha.3f7196eb",
3
+ "version": "6.20.0-dev.20251008.sha.cfbada66",
4
4
  "description": "The official MongoDB driver for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -20,7 +20,6 @@ import type { Topology } from '../sdam/topology';
20
20
  import { type Sort } from '../sort';
21
21
  import { TimeoutContext } from '../timeout';
22
22
  import {
23
- applyRetryableWrites,
24
23
  getTopology,
25
24
  hasAtomicOperators,
26
25
  maybeAddIdToDocuments,
@@ -527,15 +526,15 @@ async function executeCommands(
527
526
  finalOptions.checkKeys = false;
528
527
  }
529
528
 
530
- if (finalOptions.retryWrites) {
529
+ if (bulkOperation.retryWrites) {
531
530
  if (isUpdateBatch(batch)) {
532
- finalOptions.retryWrites =
533
- finalOptions.retryWrites && !batch.operations.some(op => op.multi);
531
+ bulkOperation.retryWrites =
532
+ bulkOperation.retryWrites && !batch.operations.some(op => op.multi);
534
533
  }
535
534
 
536
535
  if (isDeleteBatch(batch)) {
537
- finalOptions.retryWrites =
538
- finalOptions.retryWrites && !batch.operations.some(op => op.limit === 0);
536
+ bulkOperation.retryWrites =
537
+ bulkOperation.retryWrites && !batch.operations.some(op => op.limit === 0);
539
538
  }
540
539
  }
541
540
 
@@ -859,6 +858,8 @@ export abstract class BulkOperationBase {
859
858
  s: BulkOperationPrivate;
860
859
  operationId?: number;
861
860
  private collection: Collection;
861
+ /** @internal */
862
+ retryWrites?: boolean;
862
863
 
863
864
  /**
864
865
  * Create a new OrderedBulkOperation or UnorderedBulkOperation instance
@@ -866,6 +867,7 @@ export abstract class BulkOperationBase {
866
867
  */
867
868
  constructor(collection: Collection, options: BulkWriteOptions, isOrdered: boolean) {
868
869
  this.collection = collection;
870
+ this.retryWrites = collection.db.options?.retryWrites;
869
871
  // determine whether bulkOperation is ordered or unordered
870
872
  this.isOrdered = isOrdered;
871
873
 
@@ -898,10 +900,6 @@ export abstract class BulkOperationBase {
898
900
  // + 1 bytes for null terminator
899
901
  const maxKeySize = (maxWriteBatchSize - 1).toString(10).length + 2;
900
902
 
901
- // Final options for retryable writes
902
- let finalOptions = Object.assign({}, options);
903
- finalOptions = applyRetryableWrites(finalOptions, collection.db);
904
-
905
903
  // Final results
906
904
  const bulkResult: BulkResult = {
907
905
  ok: 1,
@@ -943,7 +941,7 @@ export abstract class BulkOperationBase {
943
941
  // Topology
944
942
  topology,
945
943
  // Options
946
- options: finalOptions,
944
+ options: options,
947
945
  // BSON options
948
946
  bsonOptions: resolveBSONOptions(options),
949
947
  // Current operation
@@ -17,8 +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';
20
+ import type { OperationParent } from './operations/command';
22
21
  import { type AsyncDisposable, configureResourceManagement } from './resource_management';
23
22
  import type { ServerSessionId } from './sessions';
24
23
  import { CSOTTimeoutContext, type TimeoutContext } from './timeout';
@@ -45,21 +44,6 @@ const NO_RESUME_TOKEN_ERROR =
45
44
  'A change stream document has been received that lacks a resume token (_id).';
46
45
  const CHANGESTREAM_CLOSED_ERROR = 'ChangeStream is closed';
47
46
 
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
47
  /**
64
48
  * Represents the logical starting point for a new ChangeStream or resuming a ChangeStream on the server.
65
49
  * @see https://www.mongodb.com/docs/manual/changeStreams/#std-label-change-stream-resume
@@ -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
 
@@ -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
@@ -224,7 +224,6 @@ export type {
224
224
  ChangeStreamSplitEvent,
225
225
  ChangeStreamUpdateDocument,
226
226
  OperationTime,
227
- ResumeOptions,
228
227
  ResumeToken,
229
228
  UpdateDescription
230
229
  } from './change_stream';
@@ -307,7 +306,6 @@ export type {
307
306
  ProxyOptions
308
307
  } from './cmap/connection';
309
308
  export type {
310
- CloseOptions,
311
309
  ConnectionPool,
312
310
  ConnectionPoolEvents,
313
311
  ConnectionPoolOptions,
@@ -315,7 +313,7 @@ export type {
315
313
  WaitQueueMember,
316
314
  WithConnectionCallback
317
315
  } from './cmap/connection_pool';
318
- export type { ClientMetadata, ClientMetadataOptions } from './cmap/handshake/client_metadata';
316
+ export type { ClientMetadata } from './cmap/handshake/client_metadata';
319
317
  export type { ConnectionPoolMetrics } from './cmap/metrics';
320
318
  export type { StreamDescription, StreamDescriptionOptions } from './cmap/stream_description';
321
319
  export type { CompressorName } from './cmap/wire_protocol/compression';
@@ -598,7 +596,6 @@ export type { SrvPoller, SrvPollerEvents, SrvPollerOptions } from './sdam/srv_po
598
596
  export type {
599
597
  ConnectOptions,
600
598
  SelectServerOptions,
601
- ServerCapabilities,
602
599
  ServerSelectionCallback,
603
600
  ServerSelectionRequest,
604
601
  Topology,
@@ -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[]) {
@@ -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) {