Class representing criteria for document validation, to be applied to a collection.
More...
#include <validation_criteria.hpp>
Class representing criteria for document validation, to be applied to a collection.
- See also
- https://docs.mongodb.com/manual/core/document-validation/
◆ validation_action
A class to represent the different validation action options.
- k_error: Reject any insertion or update that violates the validation criteria.
- k_warn: Log any violations of the validation criteria, but allow the insertion or update to proceed.
◆ validation_level
A class to represent the different validation level options.
- k_off: Disable validation entirely.
- k_moderate: Apply validation rules to inserts, and apply validation rules to updates only if the document to be updated already fulfills the validation criteria.
- k_strict: Apply validation rules to all inserts and updates.
◆ action() [1/2]
const stdx::optional<validation_action>& mongocxx::validation_criteria::action |
( |
| ) |
const |
Gets the validation action to run when documents failing validation are inserted or modified.
- Returns
- The enumerated validation action.
◆ action() [2/2]
Sets a validation action to run when documents failing validation are inserted or modified.
- Parameters
-
action | An enumerated validation action. |
- Returns
- A reference to the object on which this member function is being called. This facilitates method chaining.
◆ level() [1/2]
const stdx::optional<validation_level>& mongocxx::validation_criteria::level |
( |
| ) |
const |
Gets the validation level.
- Returns
- The enumerated validation level.
◆ level() [2/2]
Sets a validation level.
- Parameters
-
level | An enumerated validation level. |
- Returns
- A reference to the object on which this member function is being called. This facilitates method chaining.
◆ operator bsoncxx::document::value()
- Deprecated:
- This method is deprecated.
To determine which options are set on this object, use the provided accessors instead.
◆ rule() [1/2]
Gets the validation rule for this validation object.
- Returns
- Document representing a validation rule.
◆ rule() [2/2]
Sets a validation rule for this validation object.
- Parameters
-
rule | Document representing a validation rule. |
- Returns
- A reference to the object on which this member function is being called. This facilitates method chaining.
◆ to_document()
Returns a bson document representing this set of validation criteria.
- Deprecated:
- This method is deprecated. To determine which options are set on this object, use the provided accessors instead.
- Returns
- Validation criteria, as a document.
The documentation for this class was generated from the following file: