summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_planner.cpp
diff options
context:
space:
mode:
authorBernard Gorman <bernard.gorman@gmail.com>2021-03-24 14:07:04 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-02 21:51:14 +0000
commitea51edf33aa685e8b8d4692ee42b8c0e8e9cfb98 (patch)
treea3866340e9e80201eb9c9b675200700cc30ad53d /src/mongo/db/query/query_planner.cpp
parent0198bcfb938ccd788f90a2f5e6156871cf18330f (diff)
downloadmongo-ea51edf33aa685e8b8d4692ee42b8c0e8e9cfb98.tar.gz
SERVER-54975 Rename IDL parser classes to use CommandRequest and CommandReply suffixes
Diffstat (limited to 'src/mongo/db/query/query_planner.cpp')
-rw-r--r--src/mongo/db/query/query_planner.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/mongo/db/query/query_planner.cpp b/src/mongo/db/query/query_planner.cpp
index fb902758eb5..ab803e03254 100644
--- a/src/mongo/db/query/query_planner.cpp
+++ b/src/mongo/db/query/query_planner.cpp
@@ -341,7 +341,8 @@ std::unique_ptr<QuerySolution> buildWholeIXSoln(const IndexEntry& index,
}
bool providesSort(const CanonicalQuery& query, const BSONObj& kp) {
- return query.getFindCommand().getSort().isPrefixOf(kp, SimpleBSONElementComparator::kInstance);
+ return query.getFindCommandRequest().getSort().isPrefixOf(
+ kp, SimpleBSONElementComparator::kInstance);
}
StatusWith<std::unique_ptr<PlanCacheIndexTree>> QueryPlanner::cacheDataFromTaggedTree(
@@ -609,7 +610,7 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan(
}
const bool canTableScan = !(params.options & QueryPlannerParams::NO_TABLE_SCAN);
- const bool isTailable = query.getFindCommand().getTailable();
+ const bool isTailable = query.getFindCommandRequest().getTailable();
// If the query requests a tailable cursor, the only solution is a collscan + filter with
// tailable set on the collscan.
@@ -632,16 +633,16 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan(
// The hint can be {$natural: +/-1}. If this happens, output a collscan. We expect any $natural
// sort to have been normalized to a $natural hint upstream.
- if (!query.getFindCommand().getHint().isEmpty()) {
- const BSONObj& hintObj = query.getFindCommand().getHint();
+ if (!query.getFindCommandRequest().getHint().isEmpty()) {
+ const BSONObj& hintObj = query.getFindCommandRequest().getHint();
if (hintObj[query_request_helper::kNaturalSortField]) {
LOGV2_DEBUG(20969, 5, "Forcing a table scan due to hinted $natural");
if (!canTableScan) {
return Status(ErrorCodes::NoQueryExecutionPlans,
"hint $natural is not allowed, because 'notablescan' is enabled");
}
- if (!query.getFindCommand().getMin().isEmpty() ||
- !query.getFindCommand().getMax().isEmpty()) {
+ if (!query.getFindCommandRequest().getMin().isEmpty() ||
+ !query.getFindCommandRequest().getMax().isEmpty()) {
return Status(ErrorCodes::NoQueryExecutionPlans,
"min and max are incompatible with $natural");
}
@@ -661,7 +662,7 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan(
// requested in the query.
BSONObj hintedIndex;
if (!params.indexFiltersApplied) {
- hintedIndex = query.getFindCommand().getHint();
+ hintedIndex = query.getFindCommandRequest().getHint();
}
// Either the list of indices passed in by the caller, or the list of indices filtered according
@@ -717,15 +718,16 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan(
// Deal with the .min() and .max() query options. If either exist we can only use an index
// that matches the object inside.
- if (!query.getFindCommand().getMin().isEmpty() || !query.getFindCommand().getMax().isEmpty()) {
+ if (!query.getFindCommandRequest().getMin().isEmpty() ||
+ !query.getFindCommandRequest().getMax().isEmpty()) {
if (!hintedIndexEntry) {
return Status(ErrorCodes::Error(51173),
"When using min()/max() a hint of which index to use must be provided");
}
- BSONObj minObj = query.getFindCommand().getMin();
- BSONObj maxObj = query.getFindCommand().getMax();
+ BSONObj minObj = query.getFindCommandRequest().getMin();
+ BSONObj maxObj = query.getFindCommandRequest().getMax();
if ((!minObj.isEmpty() &&
!indexCompatibleMaxMin(minObj, query.getCollator(), *hintedIndexEntry)) ||
@@ -787,7 +789,7 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan(
//
// TEXT and GEO_NEAR are special because they require the use of a text/geo index in order
// to be evaluated correctly. Stripping these "mandatory assignments" is therefore invalid.
- if (query.getFindCommand().getProjection().isEmpty() &&
+ if (query.getFindCommandRequest().getProjection().isEmpty() &&
!QueryPlannerCommon::hasNode(query.root(), MatchExpression::GEO_NEAR) &&
!QueryPlannerCommon::hasNode(query.root(), MatchExpression::TEXT)) {
QueryPlannerIXSelect::stripUnneededAssignments(query.root(), relevantIndices);