Skip to content

Commit 8f8ea45

Browse files
feat(NODE-4925)!: remove deprecated options and types (#3513)
1 parent fe65746 commit 8f8ea45

25 files changed

+323
-398
lines changed

etc/notes/CHANGES_5.0.0.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,50 @@ The following is a detailed collection of the changes in the major v5 release of
1616

1717
## Changes
1818

19-
### salveOk options removed
19+
### `AddUserOptions.digestPassword` removed
20+
21+
The `digestPassword` option has been removed from the add user helper.
22+
23+
### Removal of Internal Types from Public API
24+
25+
The following types are used internally the driver but were accidentally exported. They have now been
26+
marked internal and are no longer exported.
27+
28+
- ServerSelector
29+
- PipeOptions
30+
- ServerOptions
31+
32+
### `DeleteOptions.single` Option Removed
33+
34+
TODO - merge in Neal's removal of `collection.remove` and combine notes
35+
36+
### Remove of `ObjectID` Type in Favor Of `ObjectId`
37+
38+
For clarity the deprecated and duplicate export ObjectID has been removed. ObjectId matches the class name and is equal in every way to the capital "D" export.
39+
40+
### Kerberos Option `gssapiCanonicalizeHostName` Removed
41+
42+
`gssapiCanonicalizeHostName` has been removed in favor of the `CANONICALIZE_HOST_NAME` value.
43+
44+
### `Projection` and `ProjectionOperations` Types Removed
45+
46+
Both of these types were unused but exported. These types have been removed. Please
47+
use `Document` instead.
48+
49+
### `CommandOperationOptions.fullResponse` Option Removed
50+
51+
The `fullResponse` option on the `CommandOperationOptions` as unused in the driver and has been removed.
52+
53+
### `BulkWriteOptions.keepGoing` Option Removed
54+
55+
The `keepGoing` option on the `BulkWriteOptions` has been removed. Please use the `ordered` option instead.
56+
57+
### `WriteConcernError.err()` Removed
58+
59+
The `err()` getter on the WriteConcernError class has been removed. The `toJSON()` method can be in place
60+
of `err()`.
61+
62+
### slaveOk options removed
2063

2164
The deprecated `slaveOk` option and `slaveOk()` method on the `Collection` class have been removed. Please
2265
now use `secondaryOk` as the replacement for the option and the method.

package-lock.json

Lines changed: 262 additions & 233 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@aws-sdk/credential-providers": "^3.201.0",
4949
"@iarna/toml": "^2.2.5",
5050
"@istanbuljs/nyc-config-typescript": "^1.0.2",
51-
"@microsoft/api-extractor": "^7.33.3",
51+
"@microsoft/api-extractor": "^7.33.7",
5252
"@microsoft/tsdoc-config": "^0.16.2",
5353
"@mongodb-js/zstd": "^1.0.0",
5454
"@types/chai": "^4.3.3",
@@ -62,12 +62,12 @@
6262
"@types/sinon": "^10.0.13",
6363
"@types/sinon-chai": "^3.2.8",
6464
"@types/whatwg-url": "^11.0.0",
65-
"@typescript-eslint/eslint-plugin": "^5.40.0",
66-
"@typescript-eslint/parser": "^5.40.0",
65+
"@typescript-eslint/eslint-plugin": "^5.48.0",
66+
"@typescript-eslint/parser": "^5.48.0",
6767
"chai": "^4.3.6",
6868
"chai-subset": "^1.6.0",
6969
"chalk": "^4.1.2",
70-
"eslint": "^8.25.0",
70+
"eslint": "^8.31.0",
7171
"eslint-config-prettier": "^8.5.0",
7272
"eslint-plugin-import": "^2.26.0",
7373
"eslint-plugin-prettier": "^4.2.1",
@@ -87,8 +87,8 @@
8787
"source-map-support": "^0.5.21",
8888
"standard-version": "^9.5.0",
8989
"ts-node": "^10.9.1",
90-
"tsd": "^0.24.1",
91-
"typescript": "^4.8.4",
90+
"tsd": "^0.25.0",
91+
"typescript": "^4.9.4",
9292
"typescript-cached-transpile": "^0.0.6",
9393
"xml2js": "^0.4.23",
9494
"yargs": "^17.6.0"

src/bulk/common.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,6 @@ export class WriteConcernError {
363363
return this[kServerError].errInfo;
364364
}
365365

366-
/** @deprecated The `err` prop that contained a MongoServerError has been deprecated. */
367-
get err(): WriteConcernErrorData {
368-
return this[kServerError];
369-
}
370-
371366
toJSON(): WriteConcernErrorData {
372367
return this[kServerError];
373368
}
@@ -876,8 +871,6 @@ export interface BulkWriteOptions extends CommandOperationOptions {
876871
bypassDocumentValidation?: boolean;
877872
/** If true, when an insert fails, don't execute the remaining writes. If false, continue with remaining inserts when one fails. */
878873
ordered?: boolean;
879-
/** @deprecated use `ordered` instead */
880-
keepGoing?: boolean;
881874
/** Force server to assign _id values instead of driver. */
882875
forceServerObjectId?: boolean;
883876
/** Map of parameter names and values that can be accessed using $$var (requires MongoDB 5.0). */

src/change_stream.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,6 @@ export type ResumeToken = unknown;
7878
*/
7979
export type OperationTime = Timestamp;
8080

81-
/**
82-
* @public
83-
* @deprecated This interface is unused and will be removed in the next major version of the driver.
84-
*/
85-
export interface PipeOptions {
86-
end?: boolean;
87-
}
88-
8981
/**
9082
* Options that can be passed to a ChangeStream. Note that startAfter, resumeAfter, and startAtOperationTime are all mutually exclusive, and the server will error if more than one is specified.
9183
* @public

src/cmap/auth/gssapi.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ export type GSSAPICanonicalizationValue =
2626
typeof GSSAPICanonicalizationValue[keyof typeof GSSAPICanonicalizationValue];
2727

2828
type MechanismProperties = {
29-
/** @deprecated use `CANONICALIZE_HOST_NAME` instead */
30-
gssapiCanonicalizeHostName?: boolean;
3129
CANONICALIZE_HOST_NAME?: GSSAPICanonicalizationValue;
3230
SERVICE_HOST?: string;
3331
SERVICE_NAME?: string;

src/cmap/auth/mongo_credentials.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Resolves the default auth mechanism according to
22
import type { Document } from '../../bson';
33
import { MongoAPIError, MongoMissingCredentialsError } from '../../error';
4-
import { emitWarningOnce } from '../../utils';
54
import { GSSAPICanonicalizationValue } from './gssapi';
65
import { AUTH_MECHS_AUTH_SRC_EXTERNAL, AuthMechanism } from './providers';
76

@@ -91,14 +90,6 @@ export class MongoCredentials {
9190
}
9291
}
9392

94-
if ('gssapiCanonicalizeHostName' in this.mechanismProperties) {
95-
emitWarningOnce(
96-
'gssapiCanonicalizeHostName is deprecated. Please use CANONICALIZE_HOST_NAME instead.'
97-
);
98-
this.mechanismProperties.CANONICALIZE_HOST_NAME =
99-
this.mechanismProperties.gssapiCanonicalizeHostName;
100-
}
101-
10293
Object.freeze(this.mechanismProperties);
10394
Object.freeze(this);
10495
}

src/collection.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,10 +1652,6 @@ export class Collection<TSchema extends Document = Document> {
16521652
options = options || { ordered: false };
16531653
docs = !Array.isArray(docs) ? [docs] : docs;
16541654

1655-
if (options.keepGoing === true) {
1656-
options.ordered = false;
1657-
}
1658-
16591655
return this.insertMany(docs, options, callback);
16601656
}
16611657

src/index.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Admin } from './admin';
2-
import { ObjectId } from './bson';
32
import { OrderedBulkOperation } from './bulk/ordered';
43
import { UnorderedBulkOperation } from './bulk/unordered';
54
import { ChangeStream } from './change_stream';
@@ -36,14 +35,8 @@ export {
3635
ObjectId,
3736
Timestamp
3837
} from './bson';
39-
export { ChangeStreamCursor } from './cursor/change_stream_cursor';
40-
/**
41-
* @public
42-
* @deprecated Please use `ObjectId`
43-
*/
44-
export const ObjectID = ObjectId;
45-
4638
export { AnyBulkWriteOperation, BulkWriteOptions, MongoBulkWriteError } from './bulk/common';
39+
export { ChangeStreamCursor } from './cursor/change_stream_cursor';
4740
export {
4841
MongoAPIError,
4942
MongoAWSError,
@@ -204,7 +197,6 @@ export type {
204197
ChangeStreamShardCollectionDocument,
205198
ChangeStreamUpdateDocument,
206199
OperationTime,
207-
PipeOptions,
208200
ResumeOptions,
209201
ResumeToken,
210202
UpdateDescription
@@ -339,8 +331,6 @@ export type {
339331
OnlyFieldsOfType,
340332
OptionalId,
341333
OptionalUnlessRequiredId,
342-
Projection,
343-
ProjectionOperators,
344334
PropertyType,
345335
PullAllOperator,
346336
PullOperator,

src/mongo_types.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -192,20 +192,6 @@ export type BSONType = typeof BSONType[keyof typeof BSONType];
192192
/** @public */
193193
export type BSONTypeAlias = keyof typeof BSONType;
194194

195-
/**
196-
* @public
197-
* Projection is flexible to permit the wide array of aggregation operators
198-
* @deprecated since v4.1.0: Since projections support all aggregation operations we have no plans to narrow this type further
199-
*/
200-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
201-
export type Projection<TSchema extends Document = Document> = Document;
202-
203-
/**
204-
* @public
205-
* @deprecated since v4.1.0: Since projections support all aggregation operations we have no plans to narrow this type further
206-
*/
207-
export type ProjectionOperators = Document;
208-
209195
/** @public */
210196
export type IsAny<Type, ResultIfAny, ResultIfNotAny> = true extends false & Type
211197
? ResultIfAny

0 commit comments

Comments
 (0)