You are currently browsing legacy 4.0 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Client API: How to Use Low-Level Commands

Low-level commands are the mechanism that Operations are built on top of.
When performing an operation, there is an underlying low-level command that is in charge of sending the appropriate request to the server (via the Request Executor) and parsing the server reply.

In order to use low-level commands directly, you will need to use the Execute or ExectueAsync method of a Request Executor.

void Execute<TResult>(RavenCommand<TResult> command, JsonOperationContext context, SessionInfo sessionInfo = null)
Task ExecuteAsync<TResult>(RavenCommand<TResult> command, JsonOperationContext context, SessionInfo sessionInfo = null, CancellationToken token = default(CancellationToken))

Examples

GetDocumentsCommand

using (var session = documentStore.OpenSession())
{
    var command = new GetDocumentsCommand("orders/1-A", null, false);
    session.Advanced.RequestExecutor.Execute(command, session.Advanced.Context);
    var order = (BlittableJsonReaderObject)command.Result.Results[0];
}
using (var session = documentStore.OpenAsyncSession())
{
    var command = new GetDocumentsCommand("orders/1-A", null, false);
    await session.Advanced.RequestExecutor.ExecuteAsync(command, session.Advanced.Context);
    var order = (BlittableJsonReaderObject)command.Result.Results[0];
}

DeleteDocumentCommand

using (var session = documentStore.OpenSession())
{
    var command = new DeleteDocumentCommand("employees/1-A", null);
    session.Advanced.RequestExecutor.Execute(command, session.Advanced.Context);
}
using (var session = documentStore.OpenAsyncSession())
{
    var command = new DeleteDocumentCommand("employees/1-A", null);
    await session.Advanced.RequestExecutor.ExecuteAsync(command, session.Advanced.Context);
}

The Following Low-Level Commands are Available:

  • BatchCommand
  • CreateSubscriptionCommand
  • DeleteDocumentCommand
  • DeleteSubscriptionCommand
  • DropSubscriptionConnectionCommand
  • ExplainQueryCommand
  • GetConflictsCommand
  • GetDocumentsCommand
  • GetIdentitiesCommand
  • GetNextOperationIdCommand
  • GetOperationStateCommand
  • GetRevisionsBinEntryCommand
  • GetRevisionsCommand
  • GetStatisticsCommand
  • GetSubscriptionsCommand
  • GetSubscriptionStateCommand
  • HeadAttachmentCommand
  • HeadDocumentCommand
  • HiLoReturnCommand
  • KillOperationCommand
  • NextHiLoCommand
  • NextIdentityForCommand
  • PatchCommand
  • PutDocumentCommand
  • QueryCommand
  • QueryStreamCommand
  • SeedIdentityForCommand
  • StartBackupCommand
  • StreamCommand