PouchDB

PouchDB is an open-source, NoSQL, in-line database. It is written in JavaScript and is bascially a javascript implementation of CouchDB.

It is modeled after CouchDB – a NoSQL database that powers npm. We can also create applications using PouchDB which can work offline and online and thus it saves data locally. PouchDB uses IndexedDB and WebSQL internally for data storage.

How PouchDB work offline ?
PouchDB works offline as well as online with the same efficiency. It works offline by storing the data locally and synchronizing it to the servers and CouchDB when online. It stores data locally using IndexedDB and WebSQL in the browser.

You can also communicate with remote and local databases continuously using PouchDB without noticing any difference.

Features of PouchDB :



  1. Open Source –
    It is available on GitHub and on other open source application.
  2. Cross-Browser –
    We can run PouchDB on various browsers as the API provided by it works the same in every environment.
  3. Easy to learn and understand –
    If you have some knowledge of programming language, PouchDB is very easy to learn and understand.
  4. Lightweight –
    We can easily include it using script tag as it has a light weight API.

Advantages of PouchDB :

  • There is no need to perform queries over network as PouchDB resides inside the browser and thus it makes it extremely faster.
  • You can run apps both online and offline as you can synchronize the data with any of the supported server.

Installing PouchDB :

  1. Download and Install Node.js and npm (Windows, Linux).
  2. Install PouchDB – Execute the following code on command prompt to install PouchDB.
    npm install pouchdb 

  3. Install PouchDB Server – Execute the following code on command prompt to install PouchDB Server.
    npm install -g pouchdb-server 

  4. Set a local Port number – Now set a port to run PouchDB:
    pouchdb-server -p 5984 

    After this, let the pointer keep on blinking.

  5. Open PouchDB – Now visit the following address.
    http://127.0.0.1:5984/ 

Now, your PouchDB installation is successful.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


4


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.