You are currently browsing legacy 4.1 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Counters



Viewing Counters Data

To view counters data, open the document they belong to.

1. Choose a database from the databases list:

Figure 1. Choose a database

2. The Counters Flag indicates which documents currently have counters.

Figure 2. A documents' Counters flag

3. Open a document.

Figure 3. Choose a document whose counters you want to review or manage

4. Counters' details are located in the Counters Tab.

Figure 4. A document's Counters information

  1. HasCounters Flag
    This flag in the document's metadata, is automatically set or removed by the server,
    indicating whether a document has Counters.
  2. Counters-Tab Header
    Click the header to open the Counters tab.
    The current number of Counters is stated on the header.
  3. Counter Name
    You can use whatever characters you choose, including Unicode symbols.
  4. Counter Value

Managing Counters

Add, Modify or Remove Counters from the Counters Tab.

Figure 5. Counter management controls

1. Click "Add Counter" to create a new Counter.

Figure 6. Add a new Counter

2. Click the Edit icon to modify a Counter's value.

Figure 7. Modify Counter 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.

Figure 8. Delete 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.

Figure 9. Export DB 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.

Figure 10. Import DB 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.