Differences between PouchDB and CouchBase Lite + LiteGap
Asked Answered
S

3

20

In a Phonegap offline/online project:

  • What is the difference between using PouchDB and using CouchBase Lite with the new LiteGap plugin?

  • Are they two different solutions to the same problem?

  • Can the PouchDB API be used to interact with a local CouchBase Lite database?

Scorify answered 24/8, 2013 at 7:47 Comment(0)
S
32

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 an external CouchDB. Also can be used as a client for an external CouchDB.

Couchbase Lite creates a iOS/Android database on the device, accesible by default on http://localhost:5984. 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.

Both solutions are available to use on a Phonegap project.

Are they two different solutions to the same problem?

In short, no.

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.

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.

Can the PouchDB API be used to interact with a local CouchBase Lite database?

Yes, but some functionality was not working as expected in my tests.

First, Couchbase Lite has no javascript HTTP API 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 localhost:5984.

Now, with Pouch you can create a database, put() or replicate from local to the cloud. However, i found problems replicating from cloud to local using Pouch's replicate.from method. One workaround to that is to setup 2-way replication using good old $.ajax to post to the device's http://localhost:5984/_replicate as if you were using node curl (passing object data with source, target, continous etc..).

I hope this helps to someone taking decisions on which technologies use when creating a offline/online syncable hybrid app.

Scorify answered 27/8, 2013 at 10:32 Comment(1)
"SQLite plugin for Cordova/PhoneGap" from this page: pouchdb.com/adapters.html says we no longer need to be aware of quotas etc. B'se PouchDB integrates with SQLite If I'm not wrong!Actinolite
H
10

Just wanted to let you know that I've written an extensive performance review showing the differences between CouchDB and Couchbase Lite.

Some findings:

  • PouchDB wins when "adding bulk documents" and "getting an document by id"
  • Couchbase Lite wins when "getting all documents"
  • they draw when "querying a document via view" (PouchDB is faster but Couchbase Lite has caching)
Hartung answered 3/2, 2014 at 8:24 Comment(0)
P
1

In addition to the 2 other answers, here is an example application from Couchbase.com blog site, of how to build a todo list application with pouchDB and sync it with CouchBase Mobile.

Another link, on Blackberry developers blog

Pedersen answered 27/9, 2015 at 14:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.