Please note, this is a STATIC archive of website www.javatpoint.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
Javatpoint Logo
Javatpoint Logo

PouchDB Delete Database

The db.destroy() method is used to delete a database in PouchDB. This method accepts a callback function as a parameter.

Syntax:


Delete Database Example

Let's delete database named "First_Database" in PouchDB using destroy() method.

Save the above code in a file named "Delete_Database.js" within a folder name "PouchDB_Examples". Open the command prompt and execute the JavaScript file using node:

PouchDB Delete database 1

Delete a Remote Database

You can delete a database that is stored remotely on the server (CouchDB). You just have to pass the path of the CouchDB database which you want to delete instead of database name.


Delete Remote Database Example

The following example will delete a database that is saved in the CouchDB server. This following code will delete the database named "employees".

PouchDB Delete database 2

Save the above code in a file named "Delete_Remote_Database.js" within a folder name "PouchDB_Examples". Open the command prompt and execute the JavaScript file using node:

Output:

PouchDB Delete database 3

Verification

The database "employees" is deleted now. You can verify it on CouchDB server. You can see that "employees" is not available in the database's list.

PouchDB Delete database 4




Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA