on_delete_filtered_docs

Attribute Macro on_delete_filtered_docs 

Source
#[on_delete_filtered_docs]
Expand description

The on_delete_filtered_docs function is a procedural macro attribute for hooking into the OnDeleteFilteredDocs event. It allows you to define custom logic to be executed when documents are deleted based on specific filter criteria.

Example:

#[on_delete_filtered_docs]
async fn on_delete_filtered_docs(context: OnDeleteFilteredDocsContext) -> Result<(), String> {
    // Your hook logic here
}

You can scope the events to a particular list of collections, making the hook more selective.

Example:

#[on_delete_filtered_docs(collections = ["demo"])]
async fn on_delete_filtered_docs(context: OnDeleteFilteredDocsContext) -> Result<(), String> {
    // Your hook logic here
}

The attributes accept a list of comma-separated collections. If the attribute array is left empty, the hook will never be called.

§Parameters

  • collections: An optional list of collections to limit the scope of the hook.
  • context: An instance of OnDeleteFilteredDocsContext containing information about the deletion event.

§Returns

  • Ok(()): Indicates successful execution of the hook logic.
  • Err(String): An error message if the hook logic encounters issues.