summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/find.cpp
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2018-04-27 11:29:15 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2018-05-01 16:02:36 -0400
commitbd0e35897b8a43d4590e23db849a1106abe9c44b (patch)
tree620e8cbf7997ea22e490142f8c43ff75befa9723 /src/mongo/db/query/find.cpp
parent51af489a86f1862de87b51f26a9e818ec3b5df04 (diff)
downloadmongo-bd0e35897b8a43d4590e23db849a1106abe9c44b.tar.gz
SERVER-34714 Optimize $or with all always-false children to $alwaysFalse
Diffstat (limited to 'src/mongo/db/query/find.cpp')
-rw-r--r--src/mongo/db/query/find.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index ba2df28842a..2e147837c98 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -527,18 +527,13 @@ std::string runQuery(OperationContext* opCtx,
// Parse the qm into a CanonicalQuery.
const boost::intrusive_ptr<ExpressionContext> expCtx;
- auto statusWithCQ =
+ auto cq = uassertStatusOKWithContext(
CanonicalQuery::canonicalize(opCtx,
q,
expCtx,
ExtensionsCallbackReal(opCtx, &nss),
- MatchExpressionParser::kAllowAllSpecialFeatures);
- if (!statusWithCQ.isOK()) {
- uasserted(17287,
- str::stream() << "Can't canonicalize query: "
- << statusWithCQ.getStatus().toString());
- }
- unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
+ MatchExpressionParser::kAllowAllSpecialFeatures),
+ "Can't canonicalize query");
invariant(cq.get());
LOG(5) << "Running query:\n" << redact(cq->toString());