Sync from PouchDB to Couchbase


#1

I have been looking to use some mechanisms to sync the documents between my browsers database and couchbase. As couchbase lite is for mobile devices not for browsers hence i moved to find PouchDB as an aternative to store offline documents on browsers and can use the sync functionality to sync between the PouchDB and Couchbase.

Researching through found that PouchDB can sync with CouchDB but found nothing for Couchbase as it uses streams in Sync gateway. Some workaround are like

PouchDB <–>CouchDB <–> Couchbase

But putting CouchDB is an extra footprint in my case where my master DB is Couchbase.

Do we have mechanism to sync between

PouchDB <–> Couchbase
or if not there is it coming in any upcoming updates.


#2

Hi,

I believe we have no plan for a connection between pouchdb and sync gateway. But we do have a plan for a JS implementation of Couchbase Lite, which should run on the browser. It’s very much work in progress right now and I have no date to give you, but it’s coming.


#3

Actually @jamiltz told me we were implementing CORS support on Sync Gateway side to allow such a thing. Documentation is not live yet but you can look at it here: https://github.com/couchbaselabs/couchbase-mobile-portal/commit/1fd3f3e5b592029cb9e39615d2b0bff0ad0a6dd0

This would require to use the master branch of Sync Gateway/


#4

Wonderful. Thanks very much.

I was trying to access the above link but didn’t worked for me.


#5

Here’s a pet project using PouchDB and Sync Gateway.

Check out the config file: https://github.com/jamiltz/GrowthHackersReader/blob/master/server/sync-gateway.json

So in your proj, you can just add the CORS setting with the domain you’re serving your web app from.

Please keep in mind this is experimental and you should use the nightly build of PouchDB and latest from master on Sync Gateway. Hope this helps, let us know how it works for you.


#6

Hello,

I want to use offline sync mechanism with couchbase lite for web application in HTML5. could you please help here. As I didn’t any web sample application which talks about offline sync mechanism in html5.

Thank you!
Narottam goyal


#7

Hey @narottam.in,

You might check this out:

http://blog.couchbase.com/cross-platform-storage-and-sync-with-ionic-framework-couchbase-and-pouchdb

Best,


#8

Is Couchbase building its own JS implementation per the comment above? Or does it officially support PouchDB?

From Couchbase’s blog posts and its mention of PouchDB in the Sync Gateway docs, it appears to be supported, but there is no mention of PouchDB in the Couchbase Mobile section on Couchbase.com.

I’m reluctant to use Couchbase because of this because I do not need or want to build a native mobile app. The mobile web is catching up to native and will beat native for the vast majority of mobile use cases IMO. If Couchbase embraced the mobile web, I think it would help attract many developers to the platform IMHO.


#9

Hey @cquillen,

PouchDB is a community driven project and, although compatible, is not supported by Couchbase. If you’d rather use something supported by Couchbase, there is the Apache Cordova plugin that supports various mobile web frameworks like PhoneGap and Ionic Framework.

You can also take a look at the community driven NativeScript plugin if you’d prefer a mobile web framework that is not Apache Cordova based:

http://blog.couchbase.com/2016/april/couchbase-mobile-in-a-cross-platform-telerik-nativescript-app

Best,


#10

Hi @nraboy,

Thanks for getting back to me. By mobile web app, I mean a pure, web-based application, not a hybrid app created with PhoneGap, Ionic, NativeScript, etc.

Does Couchbase have plans to support this?

Thanks,

Corey


#11

Hey @cquillen,

As of right now I don’t believe there are any plans to create a pure JavaScript SDK. There is a Node.js SDK, but this is a server side SDK, not 100% browser based JavaScript (hence Node).

What is your use case?

Best,


#12

Hi @nraboy,

I am building a Field Service Management application for small businesses. It has both desktop and mobile components. I want field technicians to be able to access the software super easily.

For example, an email from their manager with a link to login to the app. And I want that link to work on a desktop computer, Android device, iOS device, Windows Phone, BlackBerry, etc. Small businesses need simple, cross-platform solutions like this IMHO. And large enterprises could save a lot of money with them.

On modern mobile devices, I will give the user a chance to opt-in to offline access (via PouchDB or a Couchbase JS solution), but the offline/local database feature will be optional.

Is Couchbase a good fit for this?

Thanks!