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

Method updateOne

src/bulk/common.ts:704–714  ·  view source on GitHub ↗

Add a single update operation to the bulk operation

(updateDocument: Document | Document[])

Source from the content-addressed store, hash-verified

702
703 /** Add a single update operation to the bulk operation */
704 updateOne(updateDocument: Document | Document[]): BulkOperationBase {
705 if (!hasAtomicOperators(updateDocument, this.bulkOperation.bsonOptions)) {
706 throw new MongoInvalidArgumentError('Update document requires atomic operators');
707 }
708
709 const currentOp = buildCurrentOp(this.bulkOperation);
710 return this.bulkOperation.addToOperationsList(
711 BatchType.UPDATE,
712 makeUpdateStatement(currentOp.selector, updateDocument, { ...currentOp, multi: false })
713 );
714 }
715
716 /** Add a replace one operation to the bulk operation */
717 replaceOne(replacement: Document): BulkOperationBase {

Callers 1

renameMethod · 0.45

Calls 4

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

Tested by

no test coverage detected