summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_settings.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-06-21 14:52:55 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2016-07-07 11:28:34 -0400
commit582818dac41ac01975820c09f79d3b86dc3782cc (patch)
tree6aef7efec5f12763fe2286ad722e70bdf44205a5 /src/mongo/db/query/query_settings.cpp
parente39c46b27f4ae58f96b685dd625b0165761fee0d (diff)
downloadmongo-582818dac41ac01975820c09f79d3b86dc3782cc.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.cpp13
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);