Skip to main content

Session: How to Check if a Document Exists

  • To check whether the database contains a certain document, use the method Exists() from the Advanced session operations.

  • This does not load the document from the server or cause the session to track it.

  • In this page:

Syntax

bool Exists(string id);
ParameterTypeDescription
idstringThe ID of the document you want to check the database for
Return ValueDescription
boolIndicates whether a document with the specified ID exists in the database

Example

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

if (exists)
{
//do something
}