diff options
author | Randolph Tan <randolph@10gen.com> | 2017-11-14 16:48:50 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2017-11-29 10:34:36 -0500 |
commit | ece7d8eee78d77a1463302cad68120853af10a2a (patch) | |
tree | 7a33683a58e1ed51ebb46b95b2a779c8b7c13f79 /src/mongo/db/update | |
parent | b732abe6b1295740c3a5799c5903f84cd1857347 (diff) | |
download | mongo-ece7d8eee78d77a1463302cad68120853af10a2a.tar.gz |
SERVER-31845 Bypass query subsystem to improve config.transactions update performance
Diffstat (limited to 'src/mongo/db/update')
-rw-r--r-- | src/mongo/db/update/update_driver.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/update/update_driver.h | 1 |
2 files changed, 6 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 diff --git a/src/mongo/db/update/update_driver.h b/src/mongo/db/update/update_driver.h index 337a1abfe87..e551d5fa2e8 100644 --- a/src/mongo/db/update/update_driver.h +++ b/src/mongo/db/update/update_driver.h @@ -126,6 +126,7 @@ public: size_t numMods() const; bool isDocReplacement() const; + static bool isDocReplacement(const BSONObj& updateExpr); bool modsAffectIndices() const; void refreshIndexKeys(const UpdateIndexData* indexedFields); |