| 1. |
How To Use Db.destroy() Method With Node.js To Delete A Database? |
|
Answer» 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('database'); //deleting database db.destroy(function (err, response) { if (err) { return console.log(err); } ELSE { console.log ("Database DELETED"); } }); 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('database'); //deleting database db.destroy(function (err, response) { if (err) { return console.log(err); } else { console.log ("Database Deleted"); } }); |
|