From be6df170f0a3684a97b21de9e54e75a0e75825ed Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Mon, 10 Jul 2023 13:47:38 -0400 Subject: [PATCH 1/2] feat(NODE-5186)!: remove duplicate BulkWriteResult accessors --- src/bulk/common.ts | 72 +++++++++------------------------------------- 1 file changed, 13 insertions(+), 59 deletions(-) diff --git a/src/bulk/common.ts b/src/bulk/common.ts index 1c3b5fa5dc5..957fbafa820 100644 --- a/src/bulk/common.ts +++ b/src/bulk/common.ts @@ -212,62 +212,6 @@ export class BulkWriteResult { return this.result.ok; } - /** - * The number of inserted documents - * @deprecated Use insertedCount instead. - */ - get nInserted(): number { - return this.result.nInserted; - } - - /** - * Number of upserted documents - * @deprecated User upsertedCount instead. - */ - get nUpserted(): number { - return this.result.nUpserted; - } - - /** - * Number of matched documents - * @deprecated Use matchedCount instead. - */ - get nMatched(): number { - return this.result.nMatched; - } - - /** - * Number of documents updated physically on disk - * @deprecated Use modifiedCount instead. - */ - get nModified(): number { - return this.result.nModified; - } - - /** - * Number of removed documents - * @deprecated Use deletedCount instead. - */ - get nRemoved(): number { - return this.result.nRemoved; - } - - /** - * Returns an array of all inserted ids - * @deprecated Use insertedIds instead. - */ - getInsertedIds(): Document[] { - return this.result.insertedIds; - } - - /** - * Returns an array of all upserted ids - * @deprecated Use upsertedIds instead. - */ - getUpsertedIds(): Document[] { - return this.result.upserted; - } - /** Returns the upserted id at the given index */ getUpsertedIdAt(index: number): Document | undefined { return this.result.upserted[index]; @@ -864,11 +808,21 @@ export interface BulkOperationPrivate { /** @public */ export interface BulkWriteOptions extends CommandOperationOptions { - /** Allow driver to bypass schema validation in MongoDB 3.2 or higher. */ + /** + * Allow driver to bypass schema validation in MongoDB 3.2 or higher. + * @defaultValue `false` - documents will be validated by default + **/ bypassDocumentValidation?: boolean; - /** If true, when an insert fails, don't execute the remaining writes. If false, continue with remaining inserts when one fails. */ + /** + * If true, when an insert fails, don't execute the remaining writes. + * If false, continue with remaining inserts when one fails. + * @defaultValue `true` - inserts are ordered by default + */ ordered?: boolean; - /** Force server to assign _id values instead of driver. */ + /** + * Force server to assign _id values instead of driver. + * @defaultValue `false` - the driver generates `_id` fields by default + **/ forceServerObjectId?: boolean; /** Map of parameter names and values that can be accessed using $$var (requires MongoDB 5.0). */ let?: Document; From f21d08c7c537983508349b807a1f57736aadb99c Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Mon, 10 Jul 2023 17:22:09 -0400 Subject: [PATCH 2/2] docs: clean up old server mention for bypassDocumentValidation --- src/bulk/common.ts | 2 +- src/operations/aggregate.ts | 2 +- src/operations/find_and_modify.ts | 4 ++-- src/operations/insert.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bulk/common.ts b/src/bulk/common.ts index 957fbafa820..06b0ea012cc 100644 --- a/src/bulk/common.ts +++ b/src/bulk/common.ts @@ -809,7 +809,7 @@ export interface BulkOperationPrivate { /** @public */ export interface BulkWriteOptions extends CommandOperationOptions { /** - * Allow driver to bypass schema validation in MongoDB 3.2 or higher. + * Allow driver to bypass schema validation. * @defaultValue `false` - documents will be validated by default **/ bypassDocumentValidation?: boolean; diff --git a/src/operations/aggregate.ts b/src/operations/aggregate.ts index 47e19a4d8e2..43a1a044550 100644 --- a/src/operations/aggregate.ts +++ b/src/operations/aggregate.ts @@ -21,7 +21,7 @@ export interface AggregateOptions extends CommandOperationOptions { allowDiskUse?: boolean; /** The number of documents to return per batch. See [aggregation documentation](https://www.mongodb.com/docs/manual/reference/command/aggregate). */ batchSize?: number; - /** Allow driver to bypass schema validation in MongoDB 3.2 or higher. */ + /** Allow driver to bypass schema validation. */ bypassDocumentValidation?: boolean; /** Return the query as cursor, on 2.6 \> it returns as a real cursor on pre 2.6 it returns as an emulated cursor. */ cursor?: Document; diff --git a/src/operations/find_and_modify.ts b/src/operations/find_and_modify.ts index d92d6efbd86..763ec149303 100644 --- a/src/operations/find_and_modify.ts +++ b/src/operations/find_and_modify.ts @@ -38,7 +38,7 @@ export interface FindOneAndDeleteOptions extends CommandOperationOptions { /** @public */ export interface FindOneAndReplaceOptions extends CommandOperationOptions { - /** Allow driver to bypass schema validation in MongoDB 3.2 or higher. */ + /** Allow driver to bypass schema validation. */ bypassDocumentValidation?: boolean; /** An optional hint for query optimization. See the {@link https://www.mongodb.com/docs/manual/reference/command/update/#update-command-hint|update command} reference for more information.*/ hint?: Document; @@ -63,7 +63,7 @@ export interface FindOneAndReplaceOptions extends CommandOperationOptions { export interface FindOneAndUpdateOptions extends CommandOperationOptions { /** Optional list of array filters referenced in filtered positional operators */ arrayFilters?: Document[]; - /** Allow driver to bypass schema validation in MongoDB 3.2 or higher. */ + /** Allow driver to bypass schema validation. */ bypassDocumentValidation?: boolean; /** An optional hint for query optimization. See the {@link https://www.mongodb.com/docs/manual/reference/command/update/#update-command-hint|update command} reference for more information.*/ hint?: Document; diff --git a/src/operations/insert.ts b/src/operations/insert.ts index 7ab61ac3091..fbc17198261 100644 --- a/src/operations/insert.ts +++ b/src/operations/insert.ts @@ -53,7 +53,7 @@ export class InsertOperation extends CommandCallbackOperation { /** @public */ export interface InsertOneOptions extends CommandOperationOptions { - /** Allow driver to bypass schema validation in MongoDB 3.2 or higher. */ + /** Allow driver to bypass schema validation. */ bypassDocumentValidation?: boolean; /** Force server to assign _id values instead of driver. */ forceServerObjectId?: boolean;