pouchdb

How to load balance/failover with pouchdb/couchdb?

送分小仙女□ 提交于 2019-12-24 00:36:30
问题 Just looking for info on what strategies people use for this? In the examples I see it is really easy to make a remote database connection that I will call get() on. var remoteDb = new PouchDB('https://myhost.com/db'); var data = remoteDb.get("myId"); But what if I have several remote databases set up that are syncing with each other. I want the clients to be able to use them all without changing the code. I am considering doing this through dns. For example have db.myhost.com with multiple

Resolve Pouch Couch DB

回眸只為那壹抹淺笑 提交于 2019-12-23 16:18:32
问题 I am developing a prototype website that works offline that utilises Pouch DB so that it syncs back up to a CouchDB on a server when it goes online. The Pouch DB conflicts guide says: To resolve the conflict, you simpy put() a new revision on top of the current winner. How do you do this? I have the tried the following functions but neither work as expected: function (current, chosen) { chosen._rev = current._rev; chosen._conflicts = []; db.put(chosen); }; function (chosen) {; db.put(chosen);

synchronizing pouchDB with json data

荒凉一梦 提交于 2019-12-23 15:14:06
问题 I want to create a html page which synchronize JSON data with pouch Db. The JSON data is a response from a web service.I have created a sample html file which can create a pouch Db database.I have created rest web service which gives certain data as response. can any one help me to synchronize these two. 回答1: PouchDB has a built in method for synchronizing with CouchDB using one- or two-way replication. I understand that you want to sync with a datasource, which doesn't have a CouchDB

Couchdb/Pouchdb schema design

让人想犯罪 __ 提交于 2019-12-23 03:12:52
问题 I have an app that manages prospects. These prospects are assigned to some collaborators. They have a tablet that they use to contact our clients. The mobile app has offline support and syncs with the desktop app. I have some users that manages this collaborators and they need to have access to all prospects from their collaborators. Our current design is a cordova app, with angular and pouchdb that syncs to couchdb. The desktop app is a laravel app. We create a new couchdb database for every

One database per user security

穿精又带淫゛_ 提交于 2019-12-22 10:27:19
问题 I develop an app with Ionic where each user got its own PouchDB database synchronise with its own remote CouchDB database. I use couch_peruser=true so any user that want to access its database need to authenticate. This system is easy to do if we store the username & password locally or if we ask the user to give them anytime a sync is needed but none of these options are good (security concern or non user-friendly). I came with those two options, but none is working: 1) The best option that

PouchDB authentication: Create new CouchDB users

半腔热情 提交于 2019-12-21 04:56:07
问题 I use the PouchDB-authentication plugin and I love it. However, I'm a little confused about the signup process and maybe I don't use it the right way. I use it to create new users in my CouchDB database but I don't understand why it is associated with a specific database? Since I create CouchDB user before his specific database, I have to use a dummy database to create the new user: // Create or get a database on the CouchDB server to further create a new user var remoteDB = new PouchDB('http

Flux waitFor() and async operation, how to model.

て烟熏妆下的殇ゞ 提交于 2019-12-21 04:25:10
问题 I'm using pouchDB as a local database for an app. I want to query the results from PouchDB and load this into React.js. However, even though I'm using the waitFor() method the results of PouchDB query return too late. I think I don't understand the use of waitFor() correct, maybe someone can shed a light on it. I have two stores, the DbStore that retrieves data from the datbase. And the FileExplorerStore this store is used by my react components. DbStore.dispatchToken = AppDispatcher.register

Indexing Pouch db multi dimensional documents

空扰寡人 提交于 2019-12-19 10:16:38
问题 Looking for a way to index pouchDB Can't find a way to index when i have multiple dimensions Here is my document client example Note that client may have a few invoice { clientId : 2 clientName : 'toto' phoneNumber : '2342342' invoices : [ { invoiceNumber : '12312313' , Amount : 234242, barCode : '1234324', }, { invoiceNumber : '12312313' , Amount : 234242, barCode : '1234324', } ] } { clientId : 3 clientName : 'tata' phoneNumber : '2342342' invoices : [ { invoiceNumber : '3542435' , Amount :

How can I delete PouchDB Database indefinitly, to free space?

允我心安 提交于 2019-12-19 09:53:21
问题 How can I drop a database in PouchDB to get the space on the disk free again? Remove only sets a paramter _deleted and keeps the Data of the record anyway. But how can I delete records in a way that actually gets rid of them and saves up some space? Because I'd like to reset the database every now and then so it doesn't get too big. 回答1: It sounds like you are looking for compaction. It will do exactly what you describe. :) 回答2: You can destroy the database and create it again. var _db = new

AngularJS/PouchDB app stops syncing to CouchDB when cache.manifest added

人盡茶涼 提交于 2019-12-18 12:37:43
问题 I have a single page web app written using AngularJS. It uses PouchDB to replicate to a CouchDB server and works fine. The problem comes when I try to convert the webpage to be available offline by adding cache.manifest. Suddenly ALL the replication tasks throw errors and stop working, whether working offline or online. In Chrome it just says "GET ...myCouchIP/myDB/?_nonce=CxVFIwnEJeGFcyoJ net::ERR_FAILED" In Firefox it also throws an error but mentions that the request is blocked - try