MCPcopy
hub / github.com/mongodb/node-mongodb-native / replaceOne

Method replaceOne

src/bulk/common.ts:717–727  ·  src/bulk/common.ts::FindOperators.replaceOne

Add a replace one operation to the bulk operation

(replacement: Document)

Source from the content-addressed store, hash-verified

715
716 /** Add a replace one operation to the bulk operation */
717 replaceOne(replacement: Document): BulkOperationBase {
718 if (hasAtomicOperators(replacement)) {
719 throw new MongoInvalidArgumentError(class="st">'Replacement document must not use atomic operators');
720 }
721
722 const currentOp = buildCurrentOp(this.bulkOperation);
723 return this.bulkOperation.addToOperationsList(
724 BatchType.UPDATE,
725 makeUpdateStatement(currentOp.selector, replacement, { ...currentOp, multi: false })
726 );
727 }
728
729 /** Add a delete one operation to the bulk operation */
730 deleteOne(): BulkOperationBase {

Callers

nothing calls this directly

Calls 4

hasAtomicOperatorsFunction · 0.90
makeUpdateStatementFunction · 0.90
buildCurrentOpFunction · 0.85
addToOperationsListMethod · 0.45

Tested by

no test coverage detected