Purge ALL from a collection RavenDB 4.0

75 views
Skip to first unread message

Ian Cross

unread,
Feb 23, 2018, 5:39:04 AM2/23/18
to RavenDB - 2nd generation document database
Hi guys,

I remember reading about a year ago that due to the way collections are now stored, one of the benefits of RavenDB 4.0 was it was very fast to purge all documents in a collection. Or maybe I was dreaming?

Previously we had something that would delete using DeleteByIndex on Raven/DocumentsByEntityName using the 'Tag' of the entity name. This would be done in a loop and waiting for WaitNonStaleResults until we were certain that the collection was 100% clear. Painful but it worked.

I can see examples in the documentation that use DeleteByIndex using a where clause and this is probably ok but if there is a really fast way that leverages the optimized thing potentially discussed a while ago that would be better.

We finally started our RavenDB 4.0 migration effort last night which is a bit daunting. We used RavenFS quite a bit and also RavenDB Authorization Bundle extensively for permisions - bit shocked to see that gone last night. 

Cheers,

Ian

Derek den Haas

unread,
Feb 23, 2018, 7:29:21 AM2/23/18
to RavenDB - 2nd generation document database
DeleteByQueryOperation
store.Operations.Execute() or something

Or I guess DeletePrefixedCommandData

Op vrijdag 23 februari 2018 11:39:04 UTC+1 schreef Ian Cross:

Andrej Krivulčík

unread,
Feb 23, 2018, 8:27:00 AM2/23/18
to RavenDB - 2nd generation document database

Ian Cross

unread,
Feb 26, 2018, 11:41:37 AM2/26/18
to RavenDB - 2nd generation document database
Thanks Andrej / Derek,

We'll go down that road of using a DeleteByQuery - I wondered if there was anything new like a command to drop an entire collection without using a query but that's fine. 

Cheers,

Ian

Arkadiusz Palinski

unread,
Feb 26, 2018, 2:26:34 PM2/26/18
to rav...@googlegroups.com
Yes, that's the way to go. The query like:

from {CollectionName} 

doesn't require an index but it's handled directly by documents storage in very efficiently.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages