diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2016-07-07 16:05:06 -0400 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2016-07-07 17:39:54 -0400 |
commit | 419a2e4eaf791a8d217050dbf0ca63149f261e0f (patch) | |
tree | ba9c00ba775f0cae95cdf16e75a1ac65e7b05cc1 /src/mongo/db/query/query_settings.cpp | |
parent | 60af078e700d68999621dcd511f09220ab4d1892 (diff) | |
download | mongo-419a2e4eaf791a8d217050dbf0ca63149f261e0f.tar.gz |
SERVER-23882 Collation should be considered part of a query's shape
Diffstat (limited to 'src/mongo/db/query/query_settings.cpp')
-rw-r--r-- | src/mongo/db/query/query_settings.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mongo/db/query/query_settings.cpp b/src/mongo/db/query/query_settings.cpp index 385a4eec4c8..f2c192b2ab9 100644 --- a/src/mongo/db/query/query_settings.cpp +++ b/src/mongo/db/query/query_settings.cpp @@ -56,8 +56,12 @@ AllowedIndices::~AllowedIndices() {} AllowedIndexEntry::AllowedIndexEntry(const BSONObj& query, const BSONObj& sort, const BSONObj& projection, + const BSONObj& collation, const std::vector<BSONObj>& indexKeyPatterns) - : query(query.getOwned()), sort(sort.getOwned()), projection(projection.getOwned()) { + : query(query.getOwned()), + sort(sort.getOwned()), + projection(projection.getOwned()), + collation(collation.getOwned()) { for (std::vector<BSONObj>::const_iterator i = indexKeyPatterns.begin(); i != indexKeyPatterns.end(); ++i) { @@ -69,7 +73,8 @@ AllowedIndexEntry::AllowedIndexEntry(const BSONObj& query, AllowedIndexEntry::~AllowedIndexEntry() {} AllowedIndexEntry* AllowedIndexEntry::clone() const { - AllowedIndexEntry* entry = new AllowedIndexEntry(query, sort, projection, indexKeyPatterns); + AllowedIndexEntry* entry = + new AllowedIndexEntry(query, sort, projection, collation, indexKeyPatterns); return entry; } @@ -123,7 +128,9 @@ void QuerySettings::setAllowedIndices(const CanonicalQuery& canonicalQuery, const BSONObj& query = qr.getFilter(); const BSONObj& sort = qr.getSort(); const BSONObj& projection = qr.getProj(); - AllowedIndexEntry* entry = new AllowedIndexEntry(query, sort, projection, indexes); + const BSONObj collation = + canonicalQuery.getCollator() ? canonicalQuery.getCollator()->getSpec().toBSON() : BSONObj(); + AllowedIndexEntry* entry = new AllowedIndexEntry(query, sort, projection, collation, indexes); stdx::lock_guard<stdx::mutex> cacheLock(_mutex); AllowedIndexEntryMap::iterator i = _allowedIndexEntryMap.find(key); |