Manages MongoDB Document Schema Validators.
Create, update and remove Validators on a collection.
Supports the entire range of jsonSchema keywords.
See [jsonSchema Available Keywords](https://docs.mongodb.com/manual/reference/operator/query/jsonSchema/#available-keywords) for details.
- db (True, str, None)
- The database to work with.
- collection (True, str, None)
- The collection to work with.
- required (optional, list, None)
- List of fields that are required.
- properties (optional, dict, {})
- Individual property specification.
- action (optional, str, error)
- The validation action for MongoDB to perform when handling invalid documents.
- level (optional, str, strict)
- The validation level MongoDB should apply when updating existing documents.
- replica_set (optional, str, None)
- Replicaset name.
- state (optional, str, present)
- The state of the validator.
- debug (optional, bool, False)
- Enable additional debugging output.
- login_user (False, str, None)
The MongoDB user to login with.
Required when login_password is specified.
- login_password (False, str, None)
The password used to authenticate with.
Required when login_user is specified.
- login_database (False, str, admin)
- The database where login credentials are stored.
- login_host (False, str, localhost)
- The host running MongoDB instance to login to.
- login_port (False, int, 27017)
- The MongoDB server port to login to.
- strict_compatibility (optional, bool, True)
- Enforce strict requirements for pymongo and MongoDB software versions
- ssl (False, bool, False)
- Whether to use an SSL connection when connecting to the database.
- ssl_cert_reqs (False, str, CERT_REQUIRED)
- Specifies whether a certificate is required from the other side of the connection, and whether it will be validated if provided.
- ssl_ca_certs (False, str, None)
- The ssl_ca_certs option takes a path to a CA file.
- ssl_crlfile (False, str, None)
- The ssl_crlfile option takes a path to a CRL file.
- ssl_certfile (False, str, None)
- Present a client certificate using the ssl_certfile option.
- ssl_keyfile (False, str, None)
- Private key for the client certificate.
- ssl_pem_passphrase (False, str, None)
- Passphrase to decrypt encrypted private keys.
- auth_mechanism (False, str, None)
- Authentication type.
- connection_options (False, list, None)
Additional connection options.
Supply as a list of dicts or strings containing key value pairs seperated with '='.
Note
--- - name: Require that an email address field is in every document community.mongodb.mongodb_schema: collection: contacts db: rhys required: - email - name: Remove a schema rule community.mongodb.mongodb_schema: collection: contacts db: rhys state: absent - name: More advanced example using properties community.mongodb.mongodb_schema: collection: contacts db: rhys properties: email: maxLength: 150 minLength: 5 options: bsonType: array maxItems: 10 minItems: 5 uniqueItems: true status: bsonType: string description: "can only be ACTIVE or DISABLED" enum: - ACTIVE - DISABLED year: bsonType: int description: "must be an integer from 2021 to 3020" exclusiveMaximum: false maximum: 3020 minimum: 2021 required: - email - first_name - last_name