Info
https://github.com/mongodb/mongo/blob/0a68308f0d39a928ed551f285ba72ca560c38576/src/mongo/db/catalog/index_key_validate.cpp#L426-L441
I think line 439 should be IndexDescriptor::kHiddenFieldName, not IndexDescriptor::kIndexNameFieldName
} else if (IndexDescriptor::kIndexNameFieldName == indexSpecElemFieldName) {
if (indexSpecElem.type() != BSONType::String) {
return {ErrorCodes::TypeMismatch,
str::stream()
<< "The field '" << IndexDescriptor::kIndexNameFieldName
<< "' must be a string, but got " << typeName(indexSpecElem.type())};
}
hasIndexNameField = true;
} else if (IndexDescriptor::kHiddenFieldName == indexSpecElemFieldName) {
if (indexSpecElem.type() != BSONType::Bool) {
return {ErrorCodes::TypeMismatch,
str::stream()
// HERE - I think this message should refer to kHiddenFieldName
<< "The field '" << IndexDescriptor::kIndexNameFieldName
<< "' must be a bool, but got " << typeName(indexSpecElem.type())};
}