POUCHDB: Open source JavaScript database that can be synced at any time

Source: Internet
Author: User
Tags couchdb

Pouchdb is an open source JavaScript database that can be run in a browser. Pouchdb's data storage and processing methods are inspired by Apache Couchdb (Couchdb is a document-oriented database that can be queried and indexed by JavaScript in a mapreduce way. It also provides two-way collision detection and resolution for incremental replication.

The goal of the POUCHDB project is to help developers build Web applications that are well-used both online and offline:

    • When the application is offline, the user data can be saved locally;
    • When the online status is restored, the data is synchronized with COUCHDB and other compatible servers.

In this way, consistent data can be seen regardless of where the user is logged on or what device they are using.

Like an offline version of Gmail or Evernote apps, you can edit content anywhere, anytime, online or offline, and sync automatically the next time you log in, and you can ensure that offline content that was previously saved on different devices does not conflict when you sync.

The sample code is as follows:

JavaScript code
    1. var db = new  POUCHDB ( ' dbname ');   
    2.   
    3. Db.put ({   
    4.  _id: 
    5.  name: 
    6.  age: 66  
    7. });   
    8.   
    9. db.changes ({  
    10.   onchange: < span class= "keyword" >function ()  {  
    11.     console.log ( ' ch-ch-changes ');   
    12.   }  
    13. });  
    14.   
    15. db.replicate.to ( ' Http://example.com/mydb ');  



POUCHDB based on the Apache 2.0 Open source protocol, the code is hosted on GitHub: HTTPS://GITHUB.COM/DALEHARVEY/POUCHDB

Official website: http://pouchdb.com/
Document: Http://pouchdb.com/learn.html

POUCHDB: Open source JavaScript database that can be synced at any time

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.