summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/create_indexes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands/create_indexes.cpp')
-rw-r--r--src/mongo/db/commands/create_indexes.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index fe1370a0827..f4c2297eadc 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -166,6 +166,8 @@ StatusWith<std::vector<BSONObj>> parseAndValidateIndexSpecs(
// entry with a '*' as an index name means "drop all indexes in this
// collection". We disallow creation of such indexes to avoid this conflict.
return {ErrorCodes::BadValue, "The index name '*' is not valid."};
+ } else if (ns.isSystem() && !indexSpec[IndexDescriptor::kHiddenFieldName].eoo()) {
+ return {ErrorCodes::BadValue, "Can't hide index on system collection"};
}
indexSpecs.push_back(std::move(indexSpec));