summaryrefslogtreecommitdiff
path: root/src/mongo/db/update/arithmetic_node.cpp
diff options
context:
space:
mode:
authorJustin Seyster <justin.seyster@mongodb.com>2017-08-08 22:48:05 -0400
committerJustin Seyster <justin.seyster@mongodb.com>2017-08-08 22:49:08 -0400
commitbf99c6ff2fbd95590aa86818c07b9bc121557f06 (patch)
treedb049bdd046b31b07cfac1a9711b2f16f22976ed /src/mongo/db/update/arithmetic_node.cpp
parentc7661b14867cd058e1a67986b8e05a7020fc0a5e (diff)
downloadmongo-bf99c6ff2fbd95590aa86818c07b9bc121557f06.tar.gz
SERVER-28772 PushNode
A later commit will remove support for the deprecated $pushAll.
Diffstat (limited to 'src/mongo/db/update/arithmetic_node.cpp')
-rw-r--r--src/mongo/db/update/arithmetic_node.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/db/update/arithmetic_node.cpp b/src/mongo/db/update/arithmetic_node.cpp
index cb122bfa863..6525e714f4c 100644
--- a/src/mongo/db/update/arithmetic_node.cpp
+++ b/src/mongo/db/update/arithmetic_node.cpp
@@ -73,7 +73,10 @@ Status ArithmeticNode::init(BSONElement modExpr, const CollatorInterface* collat
return Status::OK();
}
-bool ArithmeticNode::updateExistingElement(mutablebson::Element* element) const {
+PathCreatingNode::UpdateExistingElementResult ArithmeticNode::updateExistingElement(
+ mutablebson::Element* element,
+ std::shared_ptr<FieldRef> elementPath,
+ LogBuilder* logBuilder) const {
if (!element->isNumeric()) {
mutablebson::Element idElem =
mutablebson::findFirstChildNamed(element->getDocument().root(), "_id");
@@ -101,12 +104,12 @@ bool ArithmeticNode::updateExistingElement(mutablebson::Element* element) const
// 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)) {
- return false;
+ return UpdateExistingElementResult::kNoOp;
} else {
// This can fail if 'valueToSet' is not representable as a 64-bit integer.
uassertStatusOK(element->setValueSafeNum(valueToSet));
- return true;
+ return UpdateExistingElementResult::kUpdated;
}
}