0

I'm trying to perform batch update for the list of raven documents. The code below

var result =
documentStore.DatabaseCommands.Batch(documents.Select(d =>
  new PutCommandData
  {
    Document = RavenJObject.FromObject(d), 
    Etag = null, 
    Key = d.Id, 
    Metadata = new RavenJObject(),
  }).OfType<ICommandData>());

Although there are no exceptions and batch result contains correct update timestamp, none of the documents updated in raven.

Tried to perform defer put command over a session with the same result.

Has anyone experienced the same behaviour? It seems that I'm missing something with batch updates.

Would appreciate any help and concerns.

drgraduss
  • 371
  • 2
  • 13

1 Answers1

0

You are probably writing to the system database, instead of the one you want.

documentStore.DatabaseCommands.ForDatabase("db-name")
Ayende Rahien
  • 22,925
  • 1
  • 36
  • 41
  • Hi Ayende, I tried use explicit database reference you suggested, but with no effect. Still documents not updated in raven. – drgraduss Jul 28 '14 at 09:12
  • The problem was with wrong document keys. Found this in the database logs. Thanks for the answer, Ayende. – drgraduss Jul 28 '14 at 09:26