How to Get Entity Counters


  • When a document is loaded to the session, the loaded entity will include various metadata details such as ID, current change-vector, etc.

  • If the document has Counters, the document metadata will also contain its counter names.
    The counter names are available for each entity using the get_counters_for() method from the advanced session operations.

  • In this page:


Get entity counters

# Load a document
employee = session.load("employees/1-A")

# Get counter names from the loaded entity
counter_names = session.advanced.get_counters_for(employee)

Syntax

def get_counters_for(self, entity: object) -> List[str]: ...
Parameter Type Description
entity object Instance of an entity for which counter names will be returned.
Return Type Description
List[str] Returns the counter names for the specified entity, or None if the entity has no counters.
An exception is thrown if the entity is not tracked by the session.