diff options
author | Jordi Olivares Provencio <jordi.olivares-provencio@mongodb.com> | 2022-01-18 10:05:56 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-18 10:59:20 +0000 |
commit | b920995472dcc1002d154301b06af235e6318d5d (patch) | |
tree | 160d756bfce78fd48f5acd7f68578355840eca68 /src/mongo/db/catalog | |
parent | 1f5405191a70cf5187a3fe450265cf55c5c567cf (diff) | |
download | mongo-b920995472dcc1002d154301b06af235e6318d5d.tar.gz |
SERVER-62687 Handle conflicting options for clustered collections
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r-- | src/mongo/db/catalog/create_collection.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/create_collection.cpp b/src/mongo/db/catalog/create_collection.cpp index 2ce0f9b5558..e97b1f2e3a2 100644 --- a/src/mongo/db/catalog/create_collection.cpp +++ b/src/mongo/db/catalog/create_collection.cpp @@ -459,12 +459,18 @@ Status _createCollection(OperationContext* opCtx, str::stream() << "A view already exists. NS: " << nss); } + if (!collectionOptions.clusteredIndex && collectionOptions.expireAfterSeconds) { + return Status(ErrorCodes::InvalidOptions, + "'expireAfterSeconds' requires clustering to be enabled"); + } + if (!collectionOptions.clusteredIndex && (!idIndex || idIndex->isEmpty()) && // Capped, clustered collections different in behavior significantly from normal capped // collections. Notably, they allow out-of-order insertion. !collectionOptions.capped && clusterAllCollectionsByDefault.shouldFail()) { collectionOptions.clusteredIndex = clustered_util::makeDefaultClusteredIdIndex(); } + if (auto clusteredIndex = collectionOptions.clusteredIndex) { bool clusteredIndexesEnabled = feature_flags::gClusteredIndexes.isEnabled(serverGlobalParams.featureCompatibility); |