summaryrefslogtreecommitdiff
path: root/src/mongo/db/update/arithmetic_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/update/arithmetic_node.cpp')
-rw-r--r--src/mongo/db/update/arithmetic_node.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/db/update/arithmetic_node.cpp b/src/mongo/db/update/arithmetic_node.cpp
index 69c25a87da8..cb122bfa863 100644
--- a/src/mongo/db/update/arithmetic_node.cpp
+++ b/src/mongo/db/update/arithmetic_node.cpp
@@ -73,7 +73,7 @@ Status ArithmeticNode::init(BSONElement modExpr, const CollatorInterface* collat
return Status::OK();
}
-void ArithmeticNode::updateExistingElement(mutablebson::Element* element, bool* noop) const {
+bool ArithmeticNode::updateExistingElement(mutablebson::Element* element) const {
if (!element->isNumeric()) {
mutablebson::Element idElem =
mutablebson::findFirstChildNamed(element->getDocument().root(), "_id");
@@ -101,11 +101,12 @@ void ArithmeticNode::updateExistingElement(mutablebson::Element* element, bool*
// If the updated value is identical to the original value, treat this as a no-op. Caveat:
// if the found element is in a deserialized state, we can't do that.
if (element->getValue().ok() && valueToSet.isIdentical(originalValue)) {
- *noop = true;
+ return false;
} else {
// This can fail if 'valueToSet' is not representable as a 64-bit integer.
uassertStatusOK(element->setValueSafeNum(valueToSet));
+ return true;
}
}