discontinuedPackage webapp has been discontinued and replaced by finch.

validator property

Map? validator
finalinherited

Allows users to specify validation rules or expressions for the collection. For more information, see Schema Validation.

New in version 3.2.

The validator option takes a document that specifies the validation rules or expressions. You can specify the expressions using the same operators as the query operators with the exception of $geoNear, $near, $nearSphere, $text, and $where.

Note

  • Validation occurs during updates and inserts. Existing documents do not undergo validation checks until modification.
  • You cannot specify a validator for collections in the admin, local, and config databases.
  • You cannot specify a validator for system.* collections.

Implementation

final Map? validator;