---
title: "Document Extensions: Counters"
description: "* Counters are numeric data variables that can be added to a document."
url: "https://docs.ravendb.net/6.2/studio/database/document-extensions/counters"
version: "6.2"
---

# Document Extensions: Counters

> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

\#Document Extensions: Counters

> **Note**
>
> - 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](https://docs.ravendb.net/6.2/document-extensions/counters/overview.md) or through the Studio.
>
> - In this page:
>   - [Viewing Counters Data](#viewing-counters-data)
>   - [Managing Counters](#managing-counters)
>   - [Counters Export and Import](#counters-export-and-import)

## Viewing Counters Data

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

**1.** Choose a database from the databases list:

> **Note**
>
> ![Figure 1. Choose a database](https://docs.ravendb.net/assets/images/counters-1-DBs-list-043461cfdc7d0568f64bd04f55a689aa.png)

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

> **Note**
>
> ![Figure 2. A documents' Counters flag](https://docs.ravendb.net/assets/images/counters-2-documents-list-counters-flag-f28d019807f845bbd3bf806ce8bb132d.png)

**3.** Open a document.

> **Note**
>
> ![Figure 3. Choose a document whose counters you want to review or manage](https://docs.ravendb.net/assets/images/counters-3-documents-list-98f0a1093daf56d93477fd342c6908f2.png)

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

> **Note**
>
> ![Figure 4. A document's Counters information](https://docs.ravendb.net/assets/images/counters-4-document-view-d883601ced683a43fc966de2c44d84f7.png)
>
> 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

> **Note**
>
> **Add, Modify or Remove Counters from the Counters Tab.**
>
> ![Figure 5. Counter management controls](https://docs.ravendb.net/assets/images/counters-5-management-controls-beefb4c6bd2d72230df90d6a8d250862.png)

> **Note:** 1. Click Add Counter to create a new Counter. {#1-click-add-counter-to-create-a-new-counter}
>
> ![Figure 6. Add a new Counter](https://docs.ravendb.net/assets/images/counters-6-add-new-counter-f25855b21a28651f42e6aa879036256c.png)

> **Note:** 2. Click the Edit icon to modify a Counter's value. {#2-click-the-edit-icon-to-modify-a-counter-s-value}
>
> ![Figure 7. Modify Counter value](https://docs.ravendb.net/assets/images/counters-7-modify-counter-value-76a9ec28ee69bf48b5d8421fc3186fa6.png)
>
> - **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.

> **Note:** 3. Click the Delete icon to remove a counter. {#3-click-the-delete-icon-to-remove-a-counter}
>
> ![Figure 8. Delete a Counter](https://docs.ravendb.net/assets/images/counters-8-delete-counter-d53b16de20df617cbed080be1179baf3.png)

## Counters Export and Import

You can **Export** selected components, including Counters, into a file,
and **Import** them into your database when required.

> **Note**
>
> **Export Database with Counters.**
>
> ![Figure 9. Export DB with Counters](https://docs.ravendb.net/assets/images/counters-9-export-20184f985d97511de701997cebe3f21e.png)
>
> - **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.

> **Note**
>
> **Import Database with Counters.**
>
> ![Figure 10. Import DB with Counters](https://docs.ravendb.net/assets/images/counters-10-import-df1e6372022ab39bc136b6e0847ac826.png)
>
> - **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.
