1

I have a list of records which shouldn't be in the database, a few hundred in total, due to various bugs going back years. I can delete these in code easily, but is there any way to script the delete, similar to the SQl Server DELETE..WHERE, so it can be run through the Raven UI?

2 Answers2

3

You want the DeleteByIndex method. You create an ad-hoc index specifying the data to delete.

Set-based operations

Tim Rogers
  • 21,297
  • 6
  • 52
  • 68
  • thanks, that's what I was looking for. I've got my code to script an index, which ops can then run and delete the offedning records through the Raven ui. – RavenNewbie Jan 10 '14 at 14:16
0
  using (var session = documentStore.OpenSession())
  {
            var character = session.Load<Employee>("employee/1");
            session.Delete(character);
            session.SaveChanges();
  }
eugenekgn
  • 1,652
  • 2
  • 17
  • 38
  • This only deletes a single document. The OP was asking about deleting a number of documents (aka. a 'set'). – Pure.Krome Jul 14 '16 at 14:07