diff options
Diffstat (limited to 'src/mongo/db/exec/trial_period_utils.cpp')
-rw-r--r-- | src/mongo/db/exec/trial_period_utils.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/exec/trial_period_utils.cpp b/src/mongo/db/exec/trial_period_utils.cpp index 9a7bbe8bc41..80e55f890cd 100644 --- a/src/mongo/db/exec/trial_period_utils.cpp +++ b/src/mongo/db/exec/trial_period_utils.cpp @@ -54,11 +54,12 @@ size_t getTrialPeriodNumToReturn(const CanonicalQuery& query) { // Determine the number of results which we will produce during the plan ranking phase before // stopping. size_t numResults = static_cast<size_t>(internalQueryPlanEvaluationMaxResults.load()); - if (query.getFindCommand().getNtoreturn()) { + if (query.getFindCommandRequest().getNtoreturn()) { + numResults = std::min(static_cast<size_t>(*query.getFindCommandRequest().getNtoreturn()), + numResults); + } else if (query.getFindCommandRequest().getLimit()) { numResults = - std::min(static_cast<size_t>(*query.getFindCommand().getNtoreturn()), numResults); - } else if (query.getFindCommand().getLimit()) { - numResults = std::min(static_cast<size_t>(*query.getFindCommand().getLimit()), numResults); + std::min(static_cast<size_t>(*query.getFindCommandRequest().getLimit()), numResults); } return numResults; |