summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/index_catalog.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-06-22 18:19:31 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2016-07-08 10:16:56 -0400
commit99d405ae814d9840c029bcb6916cc94aa03b9b68 (patch)
treee313172e17b1a66ad840afa1b3cce0e7582de3c2 /src/mongo/db/catalog/index_catalog.cpp
parent44599a88f8f230d110363f638eb942ea7e071bf6 (diff)
downloadmongo-99d405ae814d9840c029bcb6916cc94aa03b9b68.tar.gz
SERVER-23924 Make _id index inherit the collection's default collation
Diffstat (limited to 'src/mongo/db/catalog/index_catalog.cpp')
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index 27c74cbdd37..a0653ba6661 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -605,6 +605,12 @@ Status IndexCatalog::_isSpecOk(OperationContext* txn, const BSONObj& spec) const
if (isSparse) {
return Status(ErrorCodes::CannotCreateIndex, "_id index cannot be sparse");
}
+
+ if (collationElement &&
+ !CollatorInterface::collatorsMatch(collator.get(), _collection->getDefaultCollator())) {
+ return Status(ErrorCodes::CannotCreateIndex,
+ "_id index must have the collection default collation");
+ }
} else {
// for non _id indexes, we check to see if replication has turned off all indexes
// we _always_ created _id index