couchdb

How to setup administrators in Couchdb via Apache's HttpClient (given a curl example)

喜你入骨 提交于 2019-12-23 05:29:05
问题 So I am working on a CouchDB Gui Toolbox for easier maintaining an setting up CouchDB on Android, as Futon is quite uncomfortable on a small mobile device. I wanted to stick to the "org.apache.http.client.*" packages for this which was working out quite well until I wanted to setup administrators.. With the commandline tool "curl" it works like a charm: curl -X PUT http://127.0.0.1:5984/_config/admins/username -d '"password"' But I keep on having big problems translating that to a "org.apache

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

Re-sort a result of reduced view

我怕爱的太早我们不能终老 提交于 2019-12-23 02:57:23
问题 consider the following document structures: Thread: - doc_type 1 - _id - subject (string) Posts: - doc_type 2 - _id - thread_id (_id of Thread) - time (milliseconds since 1970) - comment (string) I need the threads sorted by the last post on a thread, together with latest 5 posts. I thought to avoid updating the thread document every time a new post is done in order to eliminate probability of conflicts in a distributed environment across db nodes. Besides, it will be working for the DB where

index and query items in an array with mango query for cloudant and couchdb 2.0

ⅰ亾dé卋堺 提交于 2019-12-23 02:23:04
问题 I have the following db structure: {"_id": "0096874","genre": ["Adventure","Comedy", "Sci-Fi" ]} {"_id": "0099088","genre": ["Comedy", "Sci-Fi", "Western"]} and like to query it like I could do in mongodb db.movies.find({genre: {$in: ["Comedy"]}}) It works when i use a text index for the whole database, but that seems very wasteful: // index { "index": {}, "type": "text" } //query { "selector": { "genre": { "$in": ["Comedy"] } }, "fields": [ "_id", "genre" ] } The following index does not

Delete couchDB databases

帅比萌擦擦* 提交于 2019-12-22 10:53:04
问题 Is there a way to delete multiple databases in Futon? Instead of creating multiple documents in one database, by mistake I ran erlang query and created about 3000 databases. Can I delete them in bulk all together? Thanks 回答1: You can't do this in bulk with Futon. However, if you have access to the server itself via SSH, you can simply delete the database files in /var/lib/couchdb/ . 来源: https://stackoverflow.com/questions/20105948/delete-couchdb-databases

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

How to write wildcard search query in couchdb where name like 'a%'

三世轮回 提交于 2019-12-22 09:29:48
问题 How can I write wildcard search in couchdb? I want to write query same as 'LIKE %' in sql.please help me for this. { "name":"arun", "surname":"mr" } { "name":"balu", "surname":"tp" } I need to list all names that start with 'a'. Thanks.. 回答1: In couchdb you can query over string ranges. First you need to have a view that emits all the names as keys function(doc){ if(doc.name) emit(doc.name,null); } Then you can query it with http://localhost:5984/your-db-name/_design/your-ddoc-name/_view/your

jQuery PUT ajax request not working

做~自己de王妃 提交于 2019-12-22 08:24:56
问题 I'm trying to save a Backbone model in couchdb so I've overridden the save method with a ajax requet to couchdb: $.ajax({ type: 'PUT', url: 'http://127.0.0.1:5984/movies/' + this.get('id'), contentType: 'application/json', data: JSON.stringify(this.toJSON()), success: function() { console.log('asdf'); }, failure: function() { console.log('test'); } }); The request is sent but when I look at the couchdb log jQuery seems to send a OPTIONS HTTP method instead of PUT : [info] [<0.1601.0>] 127.0.0

Specific couchdb views suddenly start timing out

≯℡__Kan透↙ 提交于 2019-12-22 08:07:07
问题 I have three specific views that suddenly started crashing after working smoothly for two years. Other views on the same database are just fine. This is the error in futon: Error: os_process_error OS process timed out. Couchdb version is 1.2.0. Here is the crash report logs: [Sat, 22 Dec 2012 18:28:53 GMT] [error] [<0.1434.0>] OS Process Error <0.1331.0> :: {os_process_error, "OS process timed out."} [Sat, 22 Dec 2012 18:28:53 GMT] [error] [emulator] Error in process <0.1434.0> with exit

Build tree from materialized path

自古美人都是妖i 提交于 2019-12-22 07:56:15
问题 I have a trouble building a tree structure from materialized path using ruby. Assuming I have a sorted result set (from couchdb): [ { :key => [], :value => "Home" }, { :key => ["about"], :value => "About" }, { :key => ["services"], :value => "Services" }, { :key => ["services", "plans"], :value => "Plans" }, { :key => ["services", "training"], :value => "Training" }, { :key => ["services", "training", "python"], :value => "Python" }, { :key => ["services", "training", "ruby"], :value => "Ruby