summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorIan Boros <ian.boros@mongodb.com>2019-10-29 15:55:49 +0000
committerevergreen <evergreen@mongodb.com>2019-10-29 15:55:49 +0000
commit7b95afe61b71396af1907a55f3db7bd99d337849 (patch)
tree2ab6811d61de3fb9683a7afa47c0b77f7cb63c71 /src/mongo
parentc49dfbfae5589f189ec4b8b8469cf9b255036671 (diff)
downloadmongo-7b95afe61b71396af1907a55f3db7bd99d337849.tar.gz
SERVER-40546 Fix min/max boundary checking
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/query/query_planner.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/query/query_planner.cpp b/src/mongo/db/query/query_planner.cpp
index 3e40c5a4024..43ff68ccf3a 100644
--- a/src/mongo/db/query/query_planner.cpp
+++ b/src/mongo/db/query/query_planner.cpp
@@ -657,8 +657,10 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan(
BSONObj minObj = query.getQueryRequest().getMin();
BSONObj maxObj = query.getQueryRequest().getMax();
- if (!indexCompatibleMaxMin(
- minObj.isEmpty() ? maxObj : minObj, query.getCollator(), *hintedIndexEntry)) {
+ if ((!minObj.isEmpty() &&
+ !indexCompatibleMaxMin(minObj, query.getCollator(), *hintedIndexEntry)) ||
+ (!maxObj.isEmpty() &&
+ !indexCompatibleMaxMin(maxObj, query.getCollator(), *hintedIndexEntry))) {
return Status(ErrorCodes::Error(51174),
"The index chosen is not compatible with min/max");
}