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

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Session: How to Get the Current Session Node

When working in a RavenDB cluster, a database can reside on multiple nodes. When the client needs to send a request to the server, it can have several nodes to choose from.

The choice of the node depends on the value of ReadBalanceBehavior, which is taken from the current conventions (read more about it here).

In order to find out what is the current node that the session sends its requests to, use the GetCurrentSessionNode method from the Advanced session operations.


Task<ServerNode> GetCurrentSessionNode();

Return Value

The return value of GetCurrentSessionNode is a ServerNode object

public class ServerNode
    public string Url;
    public string Database;
    public string ClusterTag;
    public Role ServerRole;

    public enum Role
        None = 0,
        Promotable = 1,
        Member = 2,
        Rehab = 4


ServerNode serverNode = await session.Advanced.GetCurrentSessionNode();