Skip to main content

Session: How to Check if a Document Exists

In order to check if a document with specific ID exists in the database, use the Exists method from the Advanced session operations.

Syntax

bool Exists(string id);
Parameters
idstringID of the document to check the existence of.
Return Value
boolIndicates if a document with the given ID exists.

Example

bool exists = session.Advanced.Exists("employees/1-A");

if (exists)
{
//do something
}