{"id":8088,"date":"2015-11-26T13:35:36","date_gmt":"2015-11-26T13:35:36","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/11\/26\/differences-between-pouchdb-and-couchbase-lite-litegap-open-source-projects-pouchdb-pouchdb\/"},"modified":"2022-08-30T15:03:01","modified_gmt":"2022-08-30T15:03:01","slug":"differences-between-pouchdb-and-couchbase-lite-litegap-open-source-projects-pouchdb-pouchdb","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/11\/26\/differences-between-pouchdb-and-couchbase-lite-litegap-open-source-projects-pouchdb-pouchdb\/","title":{"rendered":"Differences between PouchDB and CouchBase Lite + LiteGap-open source projects pouchdb\/pouchdb"},"content":{"rendered":"<p>After some research and being a relatively new topic, i thought it would be interesting to share my experiences replying my own question:<\/p>\n<p><em><strong>What is the difference between using PouchDB and using CouchBase Lite with the new LiteGap plugin?<\/strong><\/em><\/p>\n<p>PouchDB can create a local database (<code>websql<\/code> or <code>IndexedDB<\/code>) on the device and replicate it with an external CouchDB. Also can be used as a client for an external CouchDB.<\/p>\n<p>Couchbase Lite creates a iOS\/Android database on the device, accesible by default on <code>http:\/\/localhost:5984<\/code>. You can then replicate the local Couchbase Lite with other external Couchbase\/CouchDB services. LiteGap allows you to create and use a Couchbase Lite db in a PhoneGap project.<\/p>\n<p>Both solutions are available to use on a Phonegap project.<\/p>\n<p><em><strong>Are they two different solutions to the same problem?<\/strong><\/em><\/p>\n<p>In short, no.<\/p>\n<p>PouchDB is cross-platform so you can use it in a web project and also in a hybrid app. Also it provides a useful API to interact directly with a local db or external CouchDB. Being based on websql\/IndexedDB technologies, you have storage limitations that keep asking the user to allow more local storage space for your web\/app.<\/p>\n<p>Couchbase Lite is a native iOS\/Android solution that sets a Couchbase database in the device localhost. Together with the LiteGap plugin, you can use it in a Phonegap project.<\/p>\n<p><em><strong>Can the PouchDB API be used to interact with a local CouchBase Lite database?<\/strong><\/em><\/p>\n<p>Yes, but some functionality was not working as expected in my tests.<\/p>\n<p>First, Couchbase Lite has no javascript <code>HTTP API<\/code> so i thought to use Pouch to act just as client. PouchDB can use external Couch services, so we setup Pouch to use the device Couchbase Lite on <code>localhost:5984<\/code>.<\/p>\n<p>Now, with Pouch you can <code>create<\/code> a database, <code>put()<\/code> or <code>replicate<\/code> from local to the cloud. However, i found problems replicating from cloud to local using Pouch&#8217;s <code>replicate.from<\/code> method. One workaround to that is to setup 2-way replication using good old <code>$.ajax<\/code> to post to the device&#8217;s <code>http:\/\/localhost:5984\/_replicate<\/code> as if you were using node <code>curl<\/code> (passing object data with <code>source<\/code>, <code>target<\/code>, <code>continous<\/code> etc..).<\/p>\n<p>I hope this helps to someone taking decisions on which technologies use when creating a offline\/online syncable hybrid app.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After some research and being a relatively new topic, i thought it would be interesting to share my experiences replying my own question: What is the difference between using PouchDB and using CouchBase Lite with the new LiteGap plugin? PouchDB can create a local database (websql or IndexedDB) on the device and replicate it with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8088","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=8088"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8088\/revisions"}],"predecessor-version":[{"id":8635,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8088\/revisions\/8635"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=8088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=8088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=8088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}