Google News
logo
PouchDB - Interview Questions
How to use db.destroy() method with Node.js to delete a database?
Following is the syntax of using the db.destroy() method. It also accepts a callback function.

Syntax :
db.destroy()   ?

See the following example how to use db.destroy() method.

Example :
//Requiring the package  
var PouchDB = require('PouchDB');  
//Creating the database object  
var db = new PouchDB('my_database');  
//deleting database  
db.destroy(function (err, response) {  
 if (err) {  
   return console.log(err);  
 } else {  
   console.log ("Database Deleted");  
 }  
});  ?
Advertisement