diff options
author | Jason Rassi <rassi@10gen.com> | 2015-05-06 16:17:30 -0400 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2015-05-06 23:38:15 -0400 |
commit | d396bd1802a6b797a3dcfeae48dceb764320739c (patch) | |
tree | c37e82a9e3dac9294ce6f5f7ed47223d7c4eafbf /src | |
parent | c5c476f6a5f3376fbf18b3f24fc450bd34aaff10 (diff) | |
download | mongo-d396bd1802a6b797a3dcfeae48dceb764320739c.tar.gz |
SERVER-18170 Forbid creation of _id index if it's also a sparse index
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/catalog/index_catalog.cpp | 4 |
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 |