Update
Methods for updating documents.
Update
¶
Methods for updating documents.
Source code in src/scruby/mixins/update.py
update_many(new_data, filter_fn=lambda _: True)
async
¶
Asynchronous method for updates many documents matching the filter.
Attention
- For a complex case, a custom task may be needed.
- See documentation on creating custom tasks.
- The search is based on the effect of a quantum loop.
- The search effectiveness depends on the number of processor threads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter_fn
|
Callable
|
A function that execute the conditions of filtering. |
lambda _: True
|
new_data
|
dict[str, Any]
|
New data for the fields that need to be updated. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The number of updated documents. |