Remove all documents by View selection result

I have a view and I need remove all documents from bucket which selected via view.
I can select all ids and remove each document through Remove() method, but this way terribly slow in case a big amount of documents.

Hi retto -

If you want to dump the whole bucket, you can flush it from the Management Console. Otherwise, you'll have to get the view results and then loop through each key and call remove() on it.

Another approach would be to page through a smaller subset of keys and call remove on them - until the whole set is removed. If you could manage to do this asynchronously, you would probably speed things up significantly.

-Jeff

Hi Jeff,

I'm using second approach but I surprised that this feature did not implemented in couchbase. I pretty sure this is could be great enhancement.

Anyway thank you for help.

0 Answers

No answers yet