0

I've been using couchdb + flask for my ionic app.

However, my requirements have changed slightly now and I have to store a lot of lookup files in the app (transferring them everytime is very painful and slow)...

is it possible for me to use couchbase lite alongside flask + couchdb for this?

I have been trying to get some documentation/example apps but there seems to be a dearth of good documentation on this specific issue... but from what i read, it is indeed possible to sync couchbase lite and couchdb.

Another specific question I have is can I use flask to sync the two databases rather than directly connect the couchbase lite and couchdb?

Regards, Galeej

galeej
  • 535
  • 9
  • 23

2 Answers2

0

Use base64 encode if the files are binary or just dump them as a document if they are a text file.

Say I have a file foo.txt with following content:

My name is stupid.

Then I would create a document in Couchbase-lite with key foo.txt and json would look like following:

{
    "content": "My name is stupid."
}

Now that string will be replaced with base64 string if file is binary. You will need to decode it before you can use it in application.

Shiv
  • 1,912
  • 1
  • 15
  • 21
  • We considered that...but the issue is that some of the data changes often...so it would be cumbersome to change the files often... would it be possible to set up a system where couchbase lite talks to flask and updates the documents on the fly? – galeej Jan 02 '17 at 16:32
  • You can always update the "cotnent" value of a file in JSON using flask. – Shiv Jan 03 '17 at 00:03
0

Yes, Couchbase Lite (currently) works with CouchDB. Couchbase Lite implements CouchDB's replication protocol.

Regarding Flask, it depends on what you need. To get all the features, I think you'd largely end up having to reproduce the replication protocol, which is tricky.

This link may help: Couchbase-lite and CouchDB

Community
  • 1
  • 1
Hod
  • 2,236
  • 1
  • 14
  • 22