Package com.mongodb.client.model
Class ValidationOptions
java.lang.Object
com.mongodb.client.model.ValidationOptions
Validation options for documents being inserted or updated in a collection
- Since:
- 3.2
- MongoDB documentation
- Create Collection
- Since server release
- 3.2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets theValidationAction
.Gets theValidationLevel
that determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.Gets the validation rules if set or null.toString()
validationAction
(ValidationAction validationAction) Sets theValidationAction
that determines whether to error on invalid documents or just warn about the violations but allow invalid documents.validationLevel
(ValidationLevel validationLevel) Sets the validation level that determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.Sets the validation rules for all
-
Constructor Details
-
ValidationOptions
public ValidationOptions()
-
-
Method Details
-
getValidator
Gets the validation rules if set or null.- Returns:
- the validation rules if set or null
-
validator
Sets the validation rules for all- Parameters:
validator
- the validation rules- Returns:
- this
-
getValidationLevel
Gets theValidationLevel
that determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.- Returns:
- the ValidationLevel.
-
validationLevel
Sets the validation level that determines how strictly MongoDB applies the validation rules to existing documents during an insert or update.- Parameters:
validationLevel
- the validation level- Returns:
- this
-
getValidationAction
Gets theValidationAction
.- Returns:
- the ValidationAction.
-
validationAction
Sets theValidationAction
that determines whether to error on invalid documents or just warn about the violations but allow invalid documents.- Parameters:
validationAction
- the validation action- Returns:
- this
-
toString
-