Reputation: 39
I have been working on the Bluemix demo templates and have filled up a Cloudant database with 12k documents. Now I want to start over as this is test data, and want to start with a clean database.
I found I could interactively delete documents 100 at a time, but I need to just start over with a clean database.
Is there a command or menu option for this?
I tried making a new database, which was easy, but i didn't find a way to delete the old one or then rename the new one.
thanks john
Upvotes: 2
Views: 7135
Reputation: 17118
You could perform a DELETE request to your database:
curl -X DELETE https://username:[email protected]/yourdatabase
The answer indicates whether you succeeded.
As an alternative you can use the Dashboard (GUI). Once you are on the database panel and selected a single database, click the icon for settings
and select Delete
.
Upvotes: 3
Reputation: 4339
If you want to keep the existing database but remove the documents, you can use CouchDB's Bulk API.
Make a call to the all_docs end point to retrieve the current list of all document identifiers and revision. For each document retrieved, consisting the the _id and _rev fields, add a _deleted field with value true.
Now send a HTTP POST to the _bulk_docs end point for the database, with the updated documents list.
POST /database/_bulk_docs HTTP/1.1 { "docs": [ { "_id": "some_document_id", "_rev": "1-6a466d5dfda05e613ba97bd737829d67", "_deleted": true } ... ] }
Full details on the Bulk API are here.
Deleted documents will remain in your database until you run the purge command.
Upvotes: 2
Reputation: 151
If you want to do this within to dashboard, select the database you want then select the settings cog by the DB name. You'll see a Delete option.
Upvotes: 1