Delete Counter
-
Use the
counters_for.delete
method to remove a specific Counter from a document. -
All the document's Counters are deleted when the document itself is deleted.
-
For all other
counters_for
methods see this Overview. -
In this page:
delete
usage
Flow:
- Open a session.
-
Create an instance of
counters_for
.- Either pass
counters_for
an explicit document ID, -or- - Pass it an entity tracked by the session, e.g. a document object returned from session.query or from session.load.
- Either pass
- Call
document_counters.delete
. - Call
session.save_changes
for the changes to take effect.
Note:
- A Counter you deleted will be removed only after the execution of
save_changes()
. delete
will not generate an error if the Counter doesn't exist.- Deleting a document deletes all its Counters as well.
Syntax
def delete(self, counter: str) -> None: ...
Parameter | Type | Description |
---|---|---|
counter | str |
Counter name (see example) |