diff options
author | Misha Ivkov <misha.ivkov@10gen.com> | 2019-06-04 16:30:32 -0400 |
---|---|---|
committer | Misha Ivkov <misha.ivkov@10gen.com> | 2019-06-07 15:30:36 -0400 |
commit | e67db1f1c523309be615ebf1ec7f12b944b21bd9 (patch) | |
tree | fc4dfd0e3ce5a72ec4d05ffd02239253ffea6430 /src/mongo/db | |
parent | 6868af843a94de7b8e405b36f7f0a2ce1e160cbd (diff) | |
download | mongo-e67db1f1c523309be615ebf1ec7f12b944b21bd9.tar.gz |
SERVER-40546 max/min boundary checking on both
Diffstat (limited to 'src/mongo/db')
-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 655a6816194..9e8349b18d5 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"); } |