Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete RavenDB collection

I need to delete a whole collection of documents in Raven DB. Deleting one by one (documents) is not a wise choice. Is there a way I can do this easily?

like image 587
ZVenue Avatar asked Aug 11 '11 19:08

ZVenue


1 Answers

You can do a set based operation.

store.DatabaseCommands.DeleteByIndex() to do so

store.DatabaseCommands.DeleteByIndex(
    "Enquiries/MyEnquiryIndexName",
    new IndexQuery { Query = "Id:*", },
    allowStale: false);

Code sample by @Marijin

like image 186
Ayende Rahien Avatar answered Oct 22 '22 03:10

Ayende Rahien