public final class ValidationOptions extends Object
Constructor | Description |
---|---|
ValidationOptions() |
Modifier and Type | Method | Description |
---|---|---|
ValidationAction |
getValidationAction() |
Gets the
ValidationAction . |
ValidationLevel |
getValidationLevel() |
Gets the
ValidationLevel that determines how strictly MongoDB applies the validation rules to existing documents during an
insert or update. |
Bson |
getValidator() |
Gets the validation rules if set or null.
|
String |
toString() |
|
ValidationOptions |
validationAction(ValidationAction validationAction) |
Sets the
ValidationAction that determines whether to error on invalid documents or just warn about the violations but allow
invalid documents. |
ValidationOptions |
validationLevel(ValidationLevel validationLevel) |
Sets the validation level that determines how strictly MongoDB applies the validation rules to existing documents during an insert
or update.
|
ValidationOptions |
validator(Bson validator) |
Sets the validation rules for all
|
@Nullable public Bson getValidator()
public ValidationOptions validator(@Nullable Bson validator)
validator
- the validation rules@Nullable public ValidationLevel getValidationLevel()
ValidationLevel
that determines how strictly MongoDB applies the validation rules to existing documents during an
insert or update.public ValidationOptions validationLevel(@Nullable ValidationLevel validationLevel)
validationLevel
- the validation level@Nullable public ValidationAction getValidationAction()
ValidationAction
.public ValidationOptions validationAction(@Nullable ValidationAction validationAction)
ValidationAction
that determines whether to error on invalid documents or just warn about the violations but allow
invalid documents.validationAction
- the validation action