Ramosta
Ramosta

Reputation: 647

How can I delete all Documents with Ektorp in CouchDB

I'm trying to delete all the saved documents in CouchDB with Ektorp. A document can I delete so:

public void deleteDoc(Object o) {
    db.delete(o);
}

But for all Docs? can any help?

Thanks.

Upvotes: 0

Views: 849

Answers (1)

Henrik Barratt Due
Henrik Barratt Due

Reputation: 5804

If you want to delete all docs, why don't you just drop the database?

Or you can use the bulk operations in Ektorp:

List<Object> bulkDocs = ...
Sofa toBeDeleted = ...

bulkDocs.add(BulkDeleteDocument.of(toBeDeleted));

db.executeBulk(bulkDocs);

read more here: http://ektorp.org/reference_documentation.html#d100e642

Upvotes: 2

Related Questions