---
title: "Session: How to Get Entity Change-Vector"
url: "https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-change-vector"
version: "6.2"
language: "nodejs"
---

# Session: How to Get Entity Change-Vector

> Client language: Node.js. Also available for [C#](https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-change-vector.md), [Java](https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-change-vector.java.md), [Python](https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-change-vector.python.md), [PHP](https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-change-vector.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."

- The change-vector reflects the cluster-wide point in time in which a change occured, and
  includes the unique database ID, node identifier, and document Etag in the specific node.
- When a document is downloaded from the server, it contains various metadata information.  
  E.g. ID or current change-vector.
- The current change-vector is stored within the session metadata and is available for each
  entity using the `getChangeVectorFor()` method from the `advanced` session operations.

## Syntax

```javascript
session.advanced.getChangeVectorFor(entity);
```

| Parameters | | |
| - | - | - |
| **instance** | object | Instance of an entity for which an Etag will be returned. |

| Return Value | |
| - | - |
| string | Returns the current change-vector for an entity. Throws an exception if the `instance` is not tracked by the session. |

## Example

```javascript
const employee = await session.load("employees/1-A");
const changeVector = session.advanced.getChangeVectorFor(employee);
```

## See also

- [What is a Session and How Does it Work](https://docs.ravendb.net/6.2/client-api/session/what-is-a-session-and-how-does-it-work.nodejs.md)
- [How to Get and Modify Entity Metadata](https://docs.ravendb.net/6.2/client-api/session/how-to/get-and-modify-entity-metadata.nodejs.md)
- [How to Get Entity Last Modified](https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-last-modified.nodejs.md)
