diff options
author | Ian Boros <ian.boros@mongodb.com> | 2019-10-29 15:55:49 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-29 15:55:49 +0000 |
commit | 7b95afe61b71396af1907a55f3db7bd99d337849 (patch) | |
tree | 2ab6811d61de3fb9683a7afa47c0b77f7cb63c71 /src/mongo | |
parent | c49dfbfae5589f189ec4b8b8469cf9b255036671 (diff) | |
download | mongo-7b95afe61b71396af1907a55f3db7bd99d337849.tar.gz |
SERVER-40546 Fix min/max boundary checking
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/query/query_planner.cpp | 6 |
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"); } |