summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2015-05-06 16:17:30 -0400
committerJason Rassi <rassi@10gen.com>2015-05-06 23:38:15 -0400
commitd396bd1802a6b797a3dcfeae48dceb764320739c (patch)
treec37e82a9e3dac9294ce6f5f7ed47223d7c4eafbf /src/mongo/db/catalog
parentc5c476f6a5f3376fbf18b3f24fc450bd34aaff10 (diff)
downloadmongo-d396bd1802a6b797a3dcfeae48dceb764320739c.tar.gz
SERVER-18170 Forbid creation of _id index if it's also a sparse index
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index c1ce3e8fae4..9aefade3380 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -596,6 +596,10 @@ namespace {
if ( filterElement ) {
return Status( ErrorCodes::CannotCreateIndex, "_id index cannot be partial" );
}
+
+ if ( isSparse ) {
+ return Status( ErrorCodes::CannotCreateIndex, "_id index cannot be sparse" );
+ }
}
else {
// for non _id indexes, we check to see if replication has turned off all indexes