---
title: "Count Revisions"
url: "https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/counting"
version: "6.2"
language: "nodejs"
---

# Count Revisions

> Client language: Node.js. Also available for [C#](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/counting.md), [Python](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/counting.python.md), [PHP](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/counting.php.md).
>
> 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."

> **Note**
>
> - You can get the number of revisions a document has by using the advance session method `getCountFor`.
>
> - In this page:
>   - [Get revisions count](#get-revisions-count)
>   - [syntax](#syntax)

## Get revisions count

```javascript
// Get the number of revisions for document 'companies/1-A"
const revisionsCount = await session.advanced.revisions.getCountFor("companies/1-A");
```

## Syntax

```javascript
await session.advanced.revisions.getCountFor(id);
```

| Parameter | Type | Description |
| - | - | - |
| **id** | string | Document ID for which revisions are counted |

| Return value | |
| - | - |
| `Promise` | A `Promise` resolving to the number of revisions for the specified document |

## See also

- [Document Revisions Overview](https://docs.ravendb.net/6.2/document-extensions/revisions/overview.nodejs.md)
- [Revert Revisions](https://docs.ravendb.net/6.2/document-extensions/revisions/revert-documents-to-revisions/revert-documents-to-specific-time.md)
- [Revisions and Other Features](https://docs.ravendb.net/6.2/document-extensions/revisions/revisions-and-other-features.nodejs.md)
- [Revisions: API Overview](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/overview.nodejs.md)
- [Operations: Configuring Revisions](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/operations/configure-revisions.nodejs.md)
- [Session: Loading Revisions](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/loading.nodejs.md)
- [Session: Including Revisions](https://docs.ravendb.net/6.2/document-extensions/revisions/client-api/session/including.nodejs.md)
- [Settings: Document Revisions](https://docs.ravendb.net/6.2/studio/database/settings/document-revisions.md)
- [Document Extensions: Revisions](https://docs.ravendb.net/6.2/studio/database/settings/document-revisions.md)
