1.

What Is The Use Of Db.info() Method In Pouchdb?

Answer»

The db.INFO() method is used to get the information about the database. This method also accepts a CALLBACK function.

db.info([callback])

See the given example for retrieving data from the database using the info() method. Here the database name is my_database.

Example:

//REQUIRING the package 

var PouchDB = require('PouchDB'); 

//CREATING the database object 

var db = new PouchDB('my_database'); 

//Database information 

db.info(function(err, info) { 

 if (err) { 

return console.log(err); 

 } else { 

console.log(info); 

 } 

}); 

The db.info() method is used to get the information about the database. This method also accepts a callback function.

db.info([callback])

See the given example for retrieving data from the database using the info() method. Here the database name is my_database.

Example:

//Requiring the package 

var PouchDB = require('PouchDB'); 

//Creating the database object 

var db = new PouchDB('my_database'); 

//Database information 

db.info(function(err, info) { 

 if (err) { 

return console.log(err); 

 } else { 

console.log(info); 

 } 

}); 



Discussion

No Comment Found