summaryrefslogtreecommitdiff
path: root/src/mongo/db/update/update_driver.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2017-11-14 16:48:50 -0500
committerRandolph Tan <randolph@10gen.com>2017-11-29 10:34:36 -0500
commitece7d8eee78d77a1463302cad68120853af10a2a (patch)
tree7a33683a58e1ed51ebb46b95b2a779c8b7c13f79 /src/mongo/db/update/update_driver.cpp
parentb732abe6b1295740c3a5799c5903f84cd1857347 (diff)
downloadmongo-ece7d8eee78d77a1463302cad68120853af10a2a.tar.gz
SERVER-31845 Bypass query subsystem to improve config.transactions update performance
Diffstat (limited to 'src/mongo/db/update/update_driver.cpp')
-rw-r--r--src/mongo/db/update/update_driver.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/db/update/update_driver.cpp b/src/mongo/db/update/update_driver.cpp
index 7caaa4ab8a6..7ae41480779 100644
--- a/src/mongo/db/update/update_driver.cpp
+++ b/src/mongo/db/update/update_driver.cpp
@@ -166,7 +166,7 @@ Status UpdateDriver::parse(
clear();
// Check if the update expression is a full object replacement.
- if (*updateExpr.firstElementFieldName() != '$') {
+ if (isDocReplacement(updateExpr)) {
if (multi) {
return Status(ErrorCodes::FailedToParse, "multi update only works with $ operators");
}
@@ -581,4 +581,8 @@ void UpdateDriver::clear() {
_positional = false;
}
+bool UpdateDriver::isDocReplacement(const BSONObj& updateExpr) {
+ return *updateExpr.firstElementFieldName() != '$';
+}
+
} // namespace mongo