diff options
author | Minji <minjikim0202@gmail.com> | 2018-06-18 15:03:24 -0400 |
---|---|---|
committer | Minji <minjikim0202@gmail.com> | 2018-06-29 13:33:23 -0400 |
commit | 77d35b732b4aa312ba7dd3505dd90fbfe9b6753e (patch) | |
tree | b9fcd89b7ebd001aaf9c37398a7014ffdca0362e /src/mongo/db/ops | |
parent | a3f0ad233bab0f49ae19bbc14468c4b600ec794e (diff) | |
download | mongo-77d35b732b4aa312ba7dd3505dd90fbfe9b6753e.tar.gz |
SERVER-32348 Make UpdateDriver::parse() throw an exception instead of returning error Status
Diffstat (limited to 'src/mongo/db/ops')
-rw-r--r-- | src/mongo/db/ops/parsed_update.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/ops/parsed_update.h | 2 | ||||
-rw-r--r-- | src/mongo/db/ops/update.cpp | 11 |
3 files changed, 7 insertions, 14 deletions
diff --git a/src/mongo/db/ops/parsed_update.cpp b/src/mongo/db/ops/parsed_update.cpp index d7a31d0b936..f3da8cb18c3 100644 --- a/src/mongo/db/ops/parsed_update.cpp +++ b/src/mongo/db/ops/parsed_update.cpp @@ -72,9 +72,7 @@ Status ParsedUpdate::parseRequest() { // may determine whether or not we need to produce a CanonicalQuery at all. For example, if // the update involves the positional-dollar operator, we must have a CanonicalQuery even if // it isn't required for query execution. - status = parseUpdate(); - if (!status.isOK()) - return status; + parseUpdate(); status = parseQuery(); if (!status.isOK()) return status; @@ -139,12 +137,12 @@ Status ParsedUpdate::parseQueryToCQ() { return statusWithCQ.getStatus(); } -Status ParsedUpdate::parseUpdate() { +void ParsedUpdate::parseUpdate() { _driver.setCollator(_collator.get()); _driver.setLogOp(true); _driver.setFromOplogApplication(_request->isFromOplogApplication()); - return _driver.parse(_request->getUpdates(), _arrayFilters, _request->isMulti()); + _driver.parse(_request->getUpdates(), _arrayFilters, _request->isMulti()); } Status ParsedUpdate::parseArrayFilters() { diff --git a/src/mongo/db/ops/parsed_update.h b/src/mongo/db/ops/parsed_update.h index 8e006f461d1..f6334650244 100644 --- a/src/mongo/db/ops/parsed_update.h +++ b/src/mongo/db/ops/parsed_update.h @@ -131,7 +131,7 @@ private: /** * Parses the update-descriptor portion of the update request. */ - Status parseUpdate(); + void parseUpdate(); /** * Parses the array filters portion of the update request. diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp index 85664098e4d..4cacd35d047 100644 --- a/src/mongo/db/ops/update.cpp +++ b/src/mongo/db/ops/update.cpp @@ -114,19 +114,14 @@ BSONObj applyUpdateOperators(OperationContext* opCtx, boost::intrusive_ptr<ExpressionContext> expCtx(new ExpressionContext(opCtx, collator)); UpdateDriver driver(std::move(expCtx)); std::map<StringData, std::unique_ptr<ExpressionWithPlaceholder>> arrayFilters; - Status status = driver.parse(operators, arrayFilters); - if (!status.isOK()) { - uasserted(16838, status.reason()); - } + driver.parse(operators, arrayFilters); mutablebson::Document doc(from, mutablebson::Document::kInPlaceDisabled); const bool validateForStorage = false; const FieldRefSet emptyImmutablePaths; - status = driver.update(StringData(), &doc, validateForStorage, emptyImmutablePaths); - if (!status.isOK()) { - uasserted(16839, status.reason()); - } + + uassertStatusOK(driver.update(StringData(), &doc, validateForStorage, emptyImmutablePaths)); return doc.getObject(); } |