RavenDB RemoveByIndex RetrieveDetails
I have a RavenDB Index that I use to delete a bunch of documents in one go. I would like to know that many documents were actually deleted after the operation completed, however I cannot figure out how to get this information from the DatabaseCommands call. For RavenQuery / DocumentQuery, you can use Out out, but I couldn't find anything for DatabaseCommands.
I found the RetrieveDetails flag as part of BulkOperationsOptions, but I'm not sure how to actually see the details. Here is my request looks like
var op = connection.Store.DatabaseCommands.DeleteByIndex(
"Store/ByExpiration",
new IndexQuery
{
Query = "Expiration:yes"
},
new BulkOperationOptions
{
AllowStale = false,
RetrieveDetails = true
});
op.WaitForCompletion();
At this point I am not sure how to get the information after the operation is complete. Has anyone else figured out how to get this data?
source to share
The result is returned as RavenJToken
in WaitForCompletion
.
var result = op.WaitForCompletion();
The documentation for this is not clear.
Hint: when I can't find examples in the documentation, I look at the RavenDB : source code for examples like ShouldRetrieveOperationDetailsWhenTheyWereRequested unit test.
source to share