pouchdb

Sync with multiple databases

跟風遠走 提交于 2019-12-12 01:36:27
问题 How do you use sync in case there are 10 databases. Do I have to set up 10 new sync? db = new PouchDB(this.database); db.sync(remoteCouch, opts1) db.sync(remoteCouch, opts2) ... Which means it will open 10 different http connections? 回答1: Yes, it does. In that case, you may want to avoid using live replication so you don't keep 10 HTTP connections open. (I.e. just replicate one-at-a-time.) Or you can replicate from the 10 PouchDBs to a single in-memory PouchDB and then replicate from that to

CouchDB / PouchDB partial syncs with limited rights

梦想的初衷 提交于 2019-12-11 13:46:37
问题 I just stumbled across CouchDB and PouchDB sync features. Typically web applications have an application server implementing authentication, rights and business logic allowing to limit users access to specific resources/records. This brought up several questions in my mind: Is it possible to limit access to records within couch db. Eg. a super-admin sees everything, a department-manager everything of his department and a simple user only his own records or e.g. tasks assigned to him? Is

installing typings require failed in macOSX

六眼飞鱼酱① 提交于 2019-12-11 13:24:28
问题 I following a tutorial to 'use PouchDB for localStorage in ionic' and the author says i need run this command: typings install require --ambient --save i know in version 1.0 of typings, ambient changed to global but when i run this command i get an error: sudo typings install require --global --save typings ERR! message Unable to find "require" ("npm") in the registry. Did you want to try searching another source? Also, if you want contribute these typings, please help us: https://github.com

PouchDb find : why is my index not used?

醉酒当歌 提交于 2019-12-11 07:29:27
问题 I'm using PouchDb and the plugin PouchDb-find to query my local DB in an ionic web app. In almost every use case, I get the following warning when querying whereas I've created an index: { "docs": { ... }, "warning": "no matching index found, create an index to optimize query time" } Starting from an example of the plugin documentation, I get this warning so I am wondering what I am doing wrong. Here is an example: var db = new PouchDB('test'); var docs = []; for (var i = 0; i < 10; i++) {

CORS error in PouchDB with CORS enabled in CouchDB

戏子无情 提交于 2019-12-11 05:53:54
问题 I have CORS enabled in CouchDB: I run the app on Windows 8.1, serving it with hapi.js. When viewing it in Chrome after a while this error message appears in the console: Uncaught (in promise) CustomPouchError {status: 500, name: "unknown_error", message: "Database encountered an unknown error", error: true, toString: function} Firefox aborts accessing CouchDB, for instance: http://127.0.0.1:5984/user_z_at_z_p_ch/?_nonce=1431328831527, then reports that a cross origin request was blocked. I

PouchDB find() query stops working after modifying docs when using an index

邮差的信 提交于 2019-12-11 04:37:27
问题 I'm using a local PouchDB instance in a React Native v0.46.2 project. I create a database, add records to it, perform a Mango query (search for docs with a specific event ID), and the query works as expected. I then modify one record, perform the same query as before, and the results are not correct. It seems to just return the document I just modified, but none of the other documents that should be returned. If I print all docs afterwards, it shows all the documents as they should be

Pouchdb - How to display sync progress status?

时光总嘲笑我的痴心妄想 提交于 2019-12-11 04:23:52
问题 First of all, I am new to pouchdb. What I want to do is I want to display the sync progress status to user. I have localdb and remotedb. Currently I can only display the item that is already sync by console only. But the problem is, I need to display to user. For example, if the data in remotedb is 1000, I want to show the sync status progress like 4/1000 and will increase until 1000/1000. Below is my code. //declaration counter let counter:number = 0; this.db = new PouchDB('users'); /

PouchDB authentication with token (Cookie: AuthSession=xyz) lead to unsafe header “Cookie”

人走茶凉 提交于 2019-12-11 04:04:08
问题 I want to connect to my remote couchdb database by using the access token given by couchdb, this can be done by sending a header with : Cookie: AuthSession={COUCHDB_TOKEN} I have no problem doing this with curl. However with pouchDB with the following code : new PouchDB(url, { ajax: { headers: {'Cookie': 'AuthSession=couchdb_token'} } }); I got the error : Refused to set unsafe header "Cookie" Is there a way of putting this token into a header without having this error ? I have done research

PouchDb - remove object inside document

放肆的年华 提交于 2019-12-11 03:56:18
问题 I'm an Italian PouchDb and AngularJS Developer. My json document is: { "_id": "6", "_rev": "3-f7283d7683cd6fb15753f494aad1d49f", "name": "Ivrea", "owners": [ { "owner_id": 1, "name": "asdas", "address": "asdas", "gender": "Uomo", "type": "Assente", "notes": [ ] }, { "owner_id": 2, "name": "balbaba", "address": "blabla", "gender": "Uomo", "type": "Assente", "notes": [ ] } ] } and after an ng-click action, I will delete owner_id: 2 object inside _id: 6 document. In API reference I found only

CouchDB db-per-user with shared data scalability

戏子无情 提交于 2019-12-11 02:33:43
问题 I have an application with the following architecture: The master couchdb is required to share data between the users. EG: If user-1 writes data to the cloud, this replicates to the master and back to user-2 and user-3. However, as the user base increases so do the number of cloud user couchDBs, which results in a large number of replication links between the cloud user couchDBs and the master couchDB. I believe this can lead to a huge bottleneck. Is there a better way to approach this