public final class ValidationOptions
extends java.lang.Object
Constructor and Description |
---|
ValidationOptions() |
Modifier and Type | Method and 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.
|
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
|
public Bson getValidator()
public ValidationOptions validator(Bson validator)
validator
- the validation rulespublic ValidationLevel getValidationLevel()
ValidationLevel
that determines how strictly MongoDB applies the validation rules to existing documents during an
insert or update.public ValidationOptions validationLevel(ValidationLevel validationLevel)
validationLevel
- the validation levelpublic ValidationAction getValidationAction()
ValidationAction
.public ValidationOptions validationAction(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