PouchDB Database Info

The PouchDB info () method is used to get the basic information about the database.

Syntax:


Database Info() Example

The following example shows how to retrieve database information using the info() method. Let's take the database "First_Database" we have created in previous example.

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

PouchDB Database info 1

Remote Database Info

PouchDB facilitates you to get the information of a database that is located remotely on the server i.e. CouchDB. You just have to pass the path to the required database in CouchDB instead of database name.

Remote Database Info Example

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

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

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 2



Latest Courses