PouchDB Database Info



PouchDB Database Info

  • PouchDB info () - Get the basic information about the database.
 PouchDB Database Info

PouchDB Database Info

Syntax

db.info([callback])   

Database Info() Example

//Requiring the package  
var PouchDB = require('PouchDB');  
//Creating the database object  
var db = new PouchDB('First_Database');  
//Database information  
db.info(function(err, info) {  
   if (err) {  
      return console.log(err);  
   } else {  
      console.log(info);  
   }  
});  
  • Save the file named "Database_Info.js" within a folder name "PouchDB_Examples".
  • Open the command prompt and execute the JavaScript file:
node Database_Info.js  
 PouchDB Database Info

PouchDB Database Info

Remote Database Info

This code will retrieve the information of a database that is saved in the CouchDB server. The following code gives you information of a database named "employees".

Example

//Requiring the package  
var PouchDB = require('PouchDB');  
//Creating the database object  
var db = new PouchDB('http://localhost:5984/employees');  
//Database information  
db.info(function(err, info) {  
   if (err) {  
      return console.log(err);  
   } else {  
      console.log(info);  
   }  
});  
  • Save the code in a file named "Remote_Database_Info.js" .
node Remote_Database_Info.js  

Output:

{ db_name: 'employees',
update_seq: '1-g1AAAAFTeJzLYWBg4MhgTmEQTM4vTc5ISXLIyU9OzMnILy7JAUoxJTIkyf___z8rkQGPoiQFIJlkT1idA0h
dPGF1CSB19QTV5bEASYYGIAVUOj8rkZGg2gUQtfuJMfcARO19YtQ-gKgFuTcLANTpby8',
sizes: { file: 38080, external: 203, active: 360 },
purge_seq: 0,
other: { data_size: 203 },
doc_del_count: 0,
doc_count: 1,
disk_size: 38080,
disk_format_version: 6,
data_size: 360,
compact_running: false,
instance_start_time: '0',
host: 'http://localhost:5984/employees/',
auto_compaction: false,
adapter: 'http' }
 PouchDB Database Info

PouchDB Database Info



Related Searches to PouchDB Database Info