Attribute Macro assert_set_doc

Source
#[assert_set_doc]
Expand description

The assert_set_doc function is a procedural macro attribute for asserting conditions before setting a document. It enables you to define custom validation logic to be executed prior to a document creation or update.

Example:

#[assert_set_doc]
fn assert_set_doc(context: AssertSetDocContext) -> Result<(), String> {
    // Your assertion logic here
}

When no attributes are provided, the assertion logic is applied to any document set within any collection. You can scope the assertion to a particular list of collections.

Example:

#[assert_set_doc(collections = ["demo"])]
fn assert_set_doc(context: AssertSetDocContext) -> Result<(), String> {
    // Your assertion logic here
}

The attributes accept a list of comma-separated collections. If the attribute array is left empty, the assertion will always be evaluated.