Counters
-
Counters are numeric data variables that can be added to a document.
Use a Counter to count anything that needs counting, such as:- Products sales
- Voting results
- Any event related to the document
-
Create and manage Counters using API methods or through the Studio.
-
In this page:
Viewing Counters Data
To view counters data, open the document they belong to.
1. Choose a database from the databases list:
2. The Counters Flag indicates which documents currently have counters.
3. Open a document.
4. Counters' details are located in the Counters Tab.
-
HasCounters
Flag
This flag in the document's metadata, is automatically set or removed by the server,
indicating whether a document has Counters. - Counters-Tab Header
Click the header to open the Counters tab.
The current number of Counters is stated on the header. - Counter Name
You can use whatever characters you choose, including Unicode symbols. - Counter Value
Managing Counters
Add, Modify or Remove Counters from the Counters Tab.
1. Click "Add Counter" to create a new Counter.
2. Click the Edit icon to modify a Counter's value.
-
A. Counter's name - Note: Once set, the name cannot be modified.
B. Current value - The accumulated value from all nodes.
C. Enter a new value here. This value is the acculated value, see note below.
D. Confirm to carry out the update or Cancel.
E. The Counter's value per cluster node.
F. The node's e-tag. -
Note:
Modifying a Counter's value sets its accumulated value.
For example, in the above image, the Counter's value is 348 in Node A, 310 in node B, and (-25) in node C,
making its accumulated value 633.
Setting the new value to 700 from node A, will change its accumulated value to 700 by setting its value in node A to 415. -
A Counter value can be negative.
3. Click the Delete icon to remove a counter.
Counters Export and Import
You can Export selected components, including Counters, into a file, and Import them into your database when required.
Export Database with Counters.
-
1. Click the Settings gear.
2. Click Export Database.
3. Use the default name or enter your own.
4. Select the components you wish to export. Make sure Counters are included.
5. Click to export the database.
Import Database with Counters.
-
1. Click the Settings gear.
2. Click Import Data.
3. Select a file you wish to import from, or another source.
4. Select the components you wish to import. Make sure Counters are included.
5. Click to import the database.
Remember that Counters are not independent entities. You can import a Counter with its document, or into an existing document.
E.g. to import the Counters of a document named "products/1-C":
- Check "Include Documents" and "Include Counters".
This will import documents along with their Counters.- Check "Include Counters" but not "Include Documents".
Verify that a document named products/1-C already exists in your database.
The Counters will be imported into products/1-C.