mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-54888 Prohibit partial index creation on time-series bucket collections
This commit is contained in:
parent
c50fe3dc97
commit
2f37d8438c
@ -121,7 +121,15 @@ assert.commandFailedWithCode(coll.dropIndex({not_metadata: 1}), ErrorCodes.Index
|
||||
// which in this case does not possess the index by that name.
|
||||
assert.commandFailedWithCode(coll.dropIndex('mm_1'), ErrorCodes.IndexNotFound);
|
||||
|
||||
// Unique indexes are not supported
|
||||
// Partial indexes are not supported on time-series bucket collections.
|
||||
assert.commandFailedWithCode(
|
||||
coll.createIndex({[metaFieldName]: 1}, {partialFilterExpression: {meta: {$gt: 5}}}),
|
||||
ErrorCodes.InvalidOptions);
|
||||
assert.commandFailedWithCode(
|
||||
coll.createIndex({[metaFieldName]: 1}, {partialFilterExpression: {[metaFieldName]: {$gt: 5}}}),
|
||||
ErrorCodes.InvalidOptions);
|
||||
|
||||
// Unique indexes are not supported on time-series bucket collections.
|
||||
assert.commandFailedWithCode(coll.createIndex({[metaFieldName]: 1}, {unique: true}),
|
||||
ErrorCodes.InvalidOptions);
|
||||
})();
|
||||
|
@ -140,6 +140,12 @@ std::vector<BSONObj> parseAndValidateIndexSpecs(OperationContext* opCtx,
|
||||
!ns.isSystem() || indexSpec[IndexDescriptor::kHiddenFieldName].eoo());
|
||||
}
|
||||
|
||||
// TODO(SERVER-54917): Check for clustered index instead of inspecting namespace.
|
||||
uassert(ErrorCodes::InvalidOptions,
|
||||
"Partial indexes are not supported on time-series buckets collections",
|
||||
!ns.isTimeseriesBucketsCollection() ||
|
||||
!indexSpec[IndexDescriptor::kPartialFilterExprFieldName]);
|
||||
|
||||
uassert(ErrorCodes::InvalidOptions,
|
||||
"Unique indexes are not supported on time-series buckets collections",
|
||||
!ns.isTimeseriesBucketsCollection() ||
|
||||
|
Loading…
Reference in New Issue
Block a user