Skip to content

Commit

Permalink
feat(NODE-5186)!: remove duplicate BulkWriteResult accessors (#3766)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken authored Jul 11, 2023
1 parent ee56c8e commit 8693987
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 63 deletions.
72 changes: 13 additions & 59 deletions src/bulk/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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.
* @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;
Expand Down
2 changes: 1 addition & 1 deletion src/operations/aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/operations/find_and_modify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/operations/insert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class InsertOperation extends CommandCallbackOperation<Document> {

/** @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;
Expand Down

0 comments on commit 8693987

Please sign in to comment.