PiotrB
PiotrB

Reputation: 81

RavenDb patch api in embedded version of the server

Is there any difference in patch api in embedded and standard version of the server?

Is there a need to configure document store in some way to enable patch api?

I'm writing a test which use embedded raven. The code works correctly on the standard version but in test it doesn't. I'm constantly receiving patch result: DocumentDoesNotExists. I`ve checked with debugger and the document exists in the store - so it is not a problem with test.

Here you can find a repro of my issue: https://gist.github.com/pblachut/c2e0e227fa3beb51f4f9403505c292bb

Upvotes: 1

Views: 110

Answers (1)

PiotrB
PiotrB

Reputation: 81

I`ve reached the contact in the ravendb support and I have answer for my question.

There should be no difference between embedded and normal version of the server. The problem was that I did not passed explicitly for which database I want to invoke batch command. In the result I tried to patch document in system database.

var result = await documentStore.AsyncDatabaseCommands.ForDatabase("testDb).BatchAsync(new[] {command});

I assumed that database name will be taken from the session (beacuse I get documentStore from there). But the name of database should be always passed.

var documentStore = session.Advanced.DocumentStore;

Upvotes: 2

Related Questions