diff options
author | J. Rassi <rassi@10gen.com> | 2016-06-03 18:46:17 -0400 |
---|---|---|
committer | J. Rassi <rassi@10gen.com> | 2016-06-13 14:49:26 -0400 |
commit | 848949b47b5af8bb0302ee1b8dbbbcac47969d42 (patch) | |
tree | a637ee3e3801b32aba8bf05a1a63f6cddd913ef2 /src/mongo/db/query | |
parent | a63ddd2455e456c602e2ba9a4f4da0a424068f94 (diff) | |
download | mongo-848949b47b5af8bb0302ee1b8dbbbcac47969d42.tar.gz |
SERVER-23611 Distinct use collection default collation, if unspecified
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r-- | src/mongo/db/query/get_executor.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index b077efcfe7b..9f5f2626c9f 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -1332,8 +1332,12 @@ StatusWith<unique_ptr<PlanExecutor>> getExecutorDistinct(OperationContext* txn, PlanExecutor::YieldPolicy yieldPolicy) { if (!collection) { // Treat collections that do not exist as empty collections. - return PlanExecutor::make( - txn, make_unique<WorkingSet>(), make_unique<EOFStage>(txn), ns, yieldPolicy); + return PlanExecutor::make(txn, + make_unique<WorkingSet>(), + make_unique<EOFStage>(txn), + parsedDistinct->releaseQuery(), + collection, + yieldPolicy); } // TODO: check for idhack here? @@ -1397,6 +1401,12 @@ StatusWith<unique_ptr<PlanExecutor>> getExecutorDistinct(OperationContext* txn, unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); + // If the canonical query does not have a user-specified collation, set it from the collection + // default. + if (cq->getQueryRequest().getCollation().isEmpty() && collection->getDefaultCollator()) { + cq->setCollator(collection->getDefaultCollator()->clone()); + } + // If there's no query, we can just distinct-scan one of the indices. // Not every index in plannerParams.indices may be suitable. Refer to // getDistinctNodeIndex(). |