PouchDB和CouchBase Lite + LiteGap之间的区别 [英] Differences between PouchDB and CouchBase Lite + LiteGap

查看:327
本文介绍了PouchDB和CouchBase Lite + LiteGap之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Phonegap离线/在线项目中:




  • 使用PouchDB ,并使用 CouchBase Lite 与新的LiteGap 插件?


  • 它们是两种不同的解决方案同样的问题吗?


  • 是否可以使用PouchDB API与本地CouchBase Lite数据库进行交互?



解决方案

经过一些研究和作为一个相对较新的话题,我认为分享我的经验回答我自己的问题很有趣: / p>

使用PouchDB和使用CouchBase Lite与新LiteGap插件有什么区别? b
$ b

PouchDB可以在设备上创建本地数据库( websql IndexedDB )并用外部CouchDB复制它。也可以用作外部CouchDB的客户端。



Couchbase Lite在设备上创建一个iOS / Android数据库,默认情况下在 http :// localhost:5984 。然后,您可以使用其他外部Couchbase / CouchDB服务复制本地Couchbase Lite。 LiteGap允许您在PhoneGap项目中创建和使用Couchbase Lite数据库。



这两个解决方案都可以在Phonegap项目中使用。



它们是同一问题的两种不同解决方案吗?


$ b b

简而言之,不是。



PouchDB是跨平台的,因此您可以在Web项目中使用它,也可以在混合应用程序中使用它。它还提供了一个有用的API来直接与本地数据库或外部CouchDB交互。基于webql / IndexedDB技术,你有存储限制,不断要求用户为你的web /应用程序允许更多的本地存储空间。



Couchbase Lite是一个原生iOS / Android解决方案,在设备localhost中设置Couchbase数据库。与LiteGap插件一起,您可以在Phonegap项目中使用它。



PouchDB API可用于与本地CouchBase Lite数据库



是的,但某些功能在我的测试中无法正常工作。



首先,Couchbase Lite没有javascript HTTP API ,因此我认为使用Pouch作为客户端。 PouchDB可以使用外部Couch服务,因此我们设置Pouch在 localhost:5984 上使用设备Couchbase Lite。



现在,使用Pouch,您可以创建数据库, put c $ c>或复制从本地到云。但是,我发现问题从云复制到本地使用Pouch的 replicate.from 方法。一个解决方法是使用好的旧 $。ajax 设置双向复制到设备的 http:// localhost:5984 / _replicate ( source ,传递对象数据 $ c> target continous 等..)。



给某人决定在创建离线/在线可同步混合应用程序时使用哪些技术。


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?

解决方案

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.

这篇关于PouchDB和CouchBase Lite + LiteGap之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆