From 59e5ca887cf68d9e4205d6cdcd3e321d573af19f Mon Sep 17 00:00:00 2001 From: gunce Date: Fri, 13 Oct 2023 20:10:51 +0300 Subject: [PATCH 1/4] add: deprecated to jsDoc --- packages/mongo/mongo.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/mongo/mongo.d.ts b/packages/mongo/mongo.d.ts index 72199e0267..72a6d23655 100644 --- a/packages/mongo/mongo.d.ts +++ b/packages/mongo/mongo.d.ts @@ -107,6 +107,8 @@ export namespace Mongo { byteSize?: number, maxDocuments?: number ): Promise; + + /** @deprecated since 2.8 */ createIndex( indexSpec: NpmModuleMongodb.IndexSpecification, options?: NpmModuleMongodb.CreateIndexesOptions @@ -150,11 +152,13 @@ export namespace Mongo { ): Cursor>; /** * Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found. + * @deprecated since 2.8 * @param selector A query describing the documents to find */ findOne(selector?: Selector | ObjectID | string): U | undefined; /** * Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found. + * @deprecated since 2.8 * @param selector A query describing the documents to find */ findOne, 'limit'>>( @@ -178,17 +182,20 @@ export namespace Mongo { ): Promise | undefined>; /** * Gets the number of documents matching the filter. For a fast count of the total documents in a collection see `estimatedDocumentCount`. + * @deprecated * @param selector The query for filtering the set of documents to count * @param options All options are listed in [MongoDB documentation](https://mongodb.github.io/node-mongodb-native/4.11/interfaces/CountDocumentsOptions.html). Please note that not all of them are available on the client. */ countDocuments(selector?: Selector | ObjectID | string, options?: NpmModuleMongodb.CountDocumentsOptions): Promise; /** * Gets an estimate of the count of documents in a collection using collection metadata. For an exact count of the documents in a collection see `countDocuments`. + * @deprecated * @param options All options are listed in [MongoDB documentation](https://mongodb.github.io/node-mongodb-native/4.11/interfaces/CountDocumentsOptions.html). Please note that not all of them are available on the client. */ estimatedDocumentCount(options?: NpmModuleMongodb.EstimatedDocumentCountOptions): Promise; /** * Insert a document in the collection. Returns its unique _id. + * @deprecated since 2.8 * @param doc The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you. * @param callback If present, called with an error object as the first argument and, if no error, the _id as the second. */ @@ -211,6 +218,7 @@ export namespace Mongo { rawDatabase(): NpmModuleMongodb.Db; /** * Remove documents from the collection + * @deprecated since 2.8 * @param selector Specifies which documents to remove * @param callback If present, called with an error object as its argument. */ @@ -229,6 +237,7 @@ export namespace Mongo { ): Promise; /** * Modify one or more documents in the collection. Returns the number of matched documents. + * @deprecated since 2.8 * @param selector Specifies which documents to modify * @param modifier Specifies how to modify the documents * @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second. @@ -274,6 +283,7 @@ export namespace Mongo { /** * Modify one or more documents in the collection, or insert one if no matching documents were found. Returns an object with keys `numberAffected` (the number of documents modified) and * `insertedId` (the unique _id of the document that was inserted, if any). + * @deprecated since 2.8 * @param selector Specifies which documents to modify * @param modifier Specifies how to modify the documents * @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second. @@ -316,6 +326,7 @@ export namespace Mongo { options?: NpmModuleMongodb.CreateIndexesOptions ): void; _dropCollection(): Promise; + /** @deprecated since 2.8 */ _dropIndex(indexName: string): void; } From 7779d02c15961d8498b8620ae5455aa6e430792b Mon Sep 17 00:00:00 2001 From: gunce Date: Sun, 15 Oct 2023 18:03:34 +0300 Subject: [PATCH 2/4] rem: deprecated notice from jsDoc for countDocuments and estimatedDocumentCount --- packages/mongo/mongo.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/mongo/mongo.d.ts b/packages/mongo/mongo.d.ts index 72a6d23655..e568075f34 100644 --- a/packages/mongo/mongo.d.ts +++ b/packages/mongo/mongo.d.ts @@ -182,14 +182,12 @@ export namespace Mongo { ): Promise | undefined>; /** * Gets the number of documents matching the filter. For a fast count of the total documents in a collection see `estimatedDocumentCount`. - * @deprecated * @param selector The query for filtering the set of documents to count * @param options All options are listed in [MongoDB documentation](https://mongodb.github.io/node-mongodb-native/4.11/interfaces/CountDocumentsOptions.html). Please note that not all of them are available on the client. */ countDocuments(selector?: Selector | ObjectID | string, options?: NpmModuleMongodb.CountDocumentsOptions): Promise; /** * Gets an estimate of the count of documents in a collection using collection metadata. For an exact count of the documents in a collection see `countDocuments`. - * @deprecated * @param options All options are listed in [MongoDB documentation](https://mongodb.github.io/node-mongodb-native/4.11/interfaces/CountDocumentsOptions.html). Please note that not all of them are available on the client. */ estimatedDocumentCount(options?: NpmModuleMongodb.EstimatedDocumentCountOptions): Promise; From 053a13182aea64723c51a3932eb36886971928ef Mon Sep 17 00:00:00 2001 From: gunce Date: Mon, 16 Oct 2023 21:54:19 +0300 Subject: [PATCH 3/4] feat: better jsDoc for deprecated functions --- packages/mongo/mongo.d.ts | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/packages/mongo/mongo.d.ts b/packages/mongo/mongo.d.ts index e568075f34..21328eef90 100644 --- a/packages/mongo/mongo.d.ts +++ b/packages/mongo/mongo.d.ts @@ -108,7 +108,10 @@ export namespace Mongo { maxDocuments?: number ): Promise; - /** @deprecated since 2.8 */ + /** + * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @see createIndexAsync + */ createIndex( indexSpec: NpmModuleMongodb.IndexSpecification, options?: NpmModuleMongodb.CreateIndexesOptions @@ -152,13 +155,15 @@ export namespace Mongo { ): Cursor>; /** * Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found. - * @deprecated since 2.8 + * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @see findOneAsync * @param selector A query describing the documents to find */ findOne(selector?: Selector | ObjectID | string): U | undefined; /** * Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found. - * @deprecated since 2.8 + * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @see findOneAsync * @param selector A query describing the documents to find */ findOne, 'limit'>>( @@ -193,7 +198,8 @@ export namespace Mongo { estimatedDocumentCount(options?: NpmModuleMongodb.EstimatedDocumentCountOptions): Promise; /** * Insert a document in the collection. Returns its unique _id. - * @deprecated since 2.8 + * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @see insertAsync * @param doc The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you. * @param callback If present, called with an error object as the first argument and, if no error, the _id as the second. */ @@ -216,7 +222,8 @@ export namespace Mongo { rawDatabase(): NpmModuleMongodb.Db; /** * Remove documents from the collection - * @deprecated since 2.8 + * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @see removeAsync * @param selector Specifies which documents to remove * @param callback If present, called with an error object as its argument. */ @@ -235,7 +242,8 @@ export namespace Mongo { ): Promise; /** * Modify one or more documents in the collection. Returns the number of matched documents. - * @deprecated since 2.8 + * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @see updateAsync * @param selector Specifies which documents to modify * @param modifier Specifies how to modify the documents * @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second. @@ -281,7 +289,8 @@ export namespace Mongo { /** * Modify one or more documents in the collection, or insert one if no matching documents were found. Returns an object with keys `numberAffected` (the number of documents modified) and * `insertedId` (the unique _id of the document that was inserted, if any). - * @deprecated since 2.8 + * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @see upsertAsync * @param selector Specifies which documents to modify * @param modifier Specifies how to modify the documents * @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second. @@ -324,7 +333,10 @@ export namespace Mongo { options?: NpmModuleMongodb.CreateIndexesOptions ): void; _dropCollection(): Promise; - /** @deprecated since 2.8 */ + /** + * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @see dropIndexAsync + */ _dropIndex(indexName: string): void; } From d64a43c11b5cec2a4bc21b4c56d77f8b68d9afbd Mon Sep 17 00:00:00 2001 From: Jan Dvorak Date: Tue, 31 Oct 2023 16:41:53 +0100 Subject: [PATCH 4/4] Added `on server` to deprecated messages --- packages/mongo/mongo.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/mongo/mongo.d.ts b/packages/mongo/mongo.d.ts index 21328eef90..48ef98708e 100644 --- a/packages/mongo/mongo.d.ts +++ b/packages/mongo/mongo.d.ts @@ -109,7 +109,7 @@ export namespace Mongo { ): Promise; /** - * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @deprecated on server since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} * @see createIndexAsync */ createIndex( @@ -155,14 +155,14 @@ export namespace Mongo { ): Cursor>; /** * Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found. - * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @deprecated on server since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} * @see findOneAsync * @param selector A query describing the documents to find */ findOne(selector?: Selector | ObjectID | string): U | undefined; /** * Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found. - * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @deprecated on server since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} * @see findOneAsync * @param selector A query describing the documents to find */ @@ -198,7 +198,7 @@ export namespace Mongo { estimatedDocumentCount(options?: NpmModuleMongodb.EstimatedDocumentCountOptions): Promise; /** * Insert a document in the collection. Returns its unique _id. - * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @deprecated on server since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} * @see insertAsync * @param doc The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you. * @param callback If present, called with an error object as the first argument and, if no error, the _id as the second. @@ -222,7 +222,7 @@ export namespace Mongo { rawDatabase(): NpmModuleMongodb.Db; /** * Remove documents from the collection - * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @deprecated on server since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} * @see removeAsync * @param selector Specifies which documents to remove * @param callback If present, called with an error object as its argument. @@ -242,7 +242,7 @@ export namespace Mongo { ): Promise; /** * Modify one or more documents in the collection. Returns the number of matched documents. - * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @deprecated on server since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} * @see updateAsync * @param selector Specifies which documents to modify * @param modifier Specifies how to modify the documents @@ -289,7 +289,7 @@ export namespace Mongo { /** * Modify one or more documents in the collection, or insert one if no matching documents were found. Returns an object with keys `numberAffected` (the number of documents modified) and * `insertedId` (the unique _id of the document that was inserted, if any). - * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @deprecated on server since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} * @see upsertAsync * @param selector Specifies which documents to modify * @param modifier Specifies how to modify the documents @@ -334,7 +334,7 @@ export namespace Mongo { ): void; _dropCollection(): Promise; /** - * @deprecated since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} + * @deprecated on server since 2.8. Check migration guide {@link https://guide.meteor.com/2.8-migration} * @see dropIndexAsync */ _dropIndex(indexName: string): void;