diff options
Diffstat (limited to 'src/mongo/db/catalog/index_key_validate.h')
-rw-r--r-- | src/mongo/db/catalog/index_key_validate.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/index_key_validate.h b/src/mongo/db/catalog/index_key_validate.h index 3b2105bdd5c..bb2cc7ff123 100644 --- a/src/mongo/db/catalog/index_key_validate.h +++ b/src/mongo/db/catalog/index_key_validate.h @@ -33,11 +33,14 @@ namespace mongo { class BSONObj; +class CollatorInterface; class NamespaceString; class Status; template <typename T> class StatusWith; +namespace index_key_validate { + /** * Checks if the key is valid for building an index according to the validation rules for the given * index version. @@ -55,9 +58,25 @@ StatusWith<BSONObj> validateIndexSpec( const ServerGlobalParams::FeatureCompatibility& featureCompatibility); /** + * Performs additional validation for _id index specifications. This should be called after + * validateIndexSpec(). + */ +Status validateIdIndexSpec(const BSONObj& indexSpec); + +/** * Confirms that 'indexSpec' contains only valid field names. Returns an error if an unexpected * field name is found. */ Status validateIndexSpecFieldNames(const BSONObj& indexSpec); +/** + * Validates the 'collation' field in the index specification 'indexSpec' and fills in the full + * collation spec. If 'collation' is missing, fills it in with the spec for 'defaultCollator'. + * Returns the index specification with 'collation' filled in. + */ +StatusWith<BSONObj> validateIndexSpecCollation(OperationContext* txn, + const BSONObj& indexSpec, + const CollatorInterface* defaultCollator); + +} // namespace index_key_validate } // namespace mongo |