PouchDB Delete Batch
The bulkDocs() method is used to delete an array of documents in PouchDB. You just have to know the _id and _rev values of the documents that you want to delete from the database. You have to add another key-value pair _deleted: true.
We have a database named "Second_Database" stored in PouchDB and contains 3 documents:
Let's delete the documents using their respective _id and _rev values:
The batch is now deleted. You can also verify it.
You can see that there is no document in database.
Delete a Batch from Remote Database
We can also delete an array of documents in a database that is stored remotely on a server (CouchDB). You just have to pass the path to the database in CouchDB, which contains the document that you want to delete.
We have a database named "employees" in the CouchDB Server.
There are three documents in "employees" database
You can fetch these documents by using node (Read_Remote_Batch.js) command.
Now delete all the documents of database "employees".
You can see that there is no document in "employees"database.