bypassDocumentValidation

open fun bypassDocumentValidation(bypass: Boolean = true)(source)

Whether this operation is allowed to bypass document validation.

By default, or when called with false, this operation will need to respect the configured documentation validation for the current collection.

If called with true or no parameters, this operation will succeed even if documentation validation should've blocked it.

Example

class User(
val name: String,
val age: Int,
)

users.insertOne(
User("John Doe", 42),
options = { bypassDocumentValidation() }
)

See also

Configure the validation on a collection.