tinydantic.tinydb.operations
¤
TinyDB update operations.
replace
¤
replace(new: Mapping) -> Callable[[MutableMapping], None]
Build a TinyDB update transform that replaces a document.
The returned callable clears the target document and repopulates it
from new, so it fully replaces the stored contents rather than
merging. Pass it to tinydb.table.Table.update (this is how
TinydanticModel.replace
overwrites a document).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new
|
Mapping
|
The mapping to replace the document's contents with. |
required |
Returns:
| Type | Description |
|---|---|
Callable[[MutableMapping], None]
|
A transform suitable for TinyDB's update operations. |