Is couch/pouchDB appropriate for this type of usage?

50 views
Skip to first unread message

Michael Murphy

unread,
Apr 7, 2016, 4:10:30 AM4/7/16
to PouchDB
 I'm new to couchDB and pouchDB, so please forgive any obtuse ideas.  I'm also an old fart that is having a tough time grasping modern programming concepts.

That said, here's a genericized version of what I'm trying to do and I'm hoping someone can provide some perspective on the feasibility of using couch/pouchDB.

Let's pretend 10 different phone apps in 10 different regions launch an app. 

When the app launches, it calls a couchDB view and retrieves the 20 nearest retail stores (which includes a listing of each stores products).

Question #1:  I'd like to persist this list of stores and products in pouchDB.  So, I'm doing a reverse pouch. A pouchR, if you will. So I take data from couchDB and stick it in pouchDB for local use.  
The user isn't going to manipulate this data. It's just there for local reference.     

Question 1A: Is this a smart thing to do and/or a common use of pouch?
Question 1B: I've never written a phone app, but I'm assuming I can store this to a local file store for subsequent usage or when offline.  Is that a fair assumption?

The user will then pick a store and see a listing of the stores products.  The user can ask a question about any product.  
These questions will go into a local pouch which will get synched with couch. 
It's important that the user on Phone1 isn't going to see the quesions from a user on Phone 2 (even if they are asking questions about the same product in the same store).
A separate application is going to make use of the couchCB.questions data on a more global basis.

Question 2A:  Is it true that pouchDB --> couchDB synching is one way (unless I programatically do a pouchR on my own).  
Question 2B:  Are there any pitfalls I'm missing by having the many phones push data to the single couchDB table?


Many thanks for any advice.

Nolan Lawson

unread,
Apr 20, 2016, 10:26:02 AM4/20/16
to PouchDB
Hi Michael,


> Is this a smart thing to do and/or a common use of pouch?

It sounds like you are trying to implement PouchDB's sync functionality yourself? I.e. you are manually pulling data from Couch and putting it in Pouch? I would not recommend this, since there are many edge cases that users usually don't consider when they go down this path.


> I've never written a phone app, but I'm assuming I can store this to a local file store for subsequent usage or when offline.  Is that a fair assumption?

Yes. :)

> Is it true that pouchDB --> couchDB synching is one way?

No, it is bidrectional, see http://pouchdb.com/api.html#sync


> Are there any pitfalls I'm missing by having the many phones push data to the single couchDB table?

A single Couch can handle many tens of thousands of concurrent transactions, and if you need more throughput, you can just replicate to another one and then route traffic half to one, half to the other. For many years this is how NPM worked.

Cheers,
Nolan
Reply all
Reply to author
Forward
0 new messages