Annotation Interface Validation


@Documented @Inherited @Retention(RUNTIME) @Target(TYPE) public @interface Validation
Defines the document validation logic for a collection.
Since:
1.3
  • Element Details

    • value

      String value
      Returns:
      the query used to validate documents in a collection. This query is not validated so care must be taken to ensure document field names and types are correct.
      MongoDB documentation
      core/document-validation/
    • level

      Returns:
      how strictly MongoDB should apply the validation rules to existing documents during an insert or update.
      See Also:
      Default:
      STRICT
    • action

      Returns:
      how strictly MongoDB should apply the validation rules to existing documents during an insert or update.
      See Also:
      Default:
      ERROR