couchdb-futon

Custom rest api's for CouchDB?

北城余情 提交于 2020-01-05 05:00:50
问题 I have been googling around trying to find examples or just a straight answer to my question. Is it possible to create/extend my own custom api endpoints for couchDB? Such as for example can I create a api call like http://127.0.0.1:5984/database/FillDatabase/... to fill the database with data? If couchDB does indeed provide this functionality, then please provide me with a link perhaps to some tutorial/guide/example if possible. Thanks. 回答1: You may want the _rewrites feature, which allows

couchdb futon document editor - can I customize the indentation rules?

僤鯓⒐⒋嵵緔 提交于 2019-12-25 18:19:23
问题 Suppose that I want to customize the indentation rules of the foton document editor, where and how can I do that? I'll elaborate. The foton editor lays out document like this: (which to my flavor is completely annoying) { "_id": "1326017821636", "_rev": "2-51ab614953437181a24f1c073fbc6201", "doc_type": 0, "step": 2, "data": { "map1": { "attr1": 73031, "attr2": "strval" }, "map2": { "att1": 52001, "att2": "strval" }, "mapmap": { "map": { "id11": { "id": "id11", "attr": "attr", "attr2": 2222 },

How can I optimize the view and avoid timeout error

我的未来我决定 提交于 2019-12-25 08:55:27
问题 I had a view map/reduce defined as following,as most of documents have no doc.emails[i].userTypecode elements in couchdb, so it is running the view takes too long causing couch to give up / time out: the error is Error: os_preocess_error, OS process time out, can some one help me how to figure out this issue and how to optimize the map/reduce? thank you I checked there are similar issue happened , but no idea how that were fixed?https://issues.apache.org/jira/browse/COUCHDB-1333 couchdb views

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

Find The Duplicate value in CouchDb

霸气de小男生 提交于 2019-12-12 09:57:24
问题 I want to find same value in CouchDB. My Map is function(doc) { var user = []; if(doc.type = 'user'){ user.push(doc.name); emit( doc.type, user); } } And I have the results like ["Bob"],["Peter"],["Bob"] .... I'd Like to Have a reduce like ["Bob","Peter","Bob"] Or an Array with only duplicate ["Bob","Bob"] I don't understand How reduce works. foreach value reduce is called or only when the map is finished? 回答1: Let's say you have the following three documents. Bob: { "_id":

is there a way to clear duplication record from results?

♀尐吖头ヾ 提交于 2019-12-12 06:08:50
问题 I have a view but did have duplicated documents from the results of view as like following, how can I get the duplicate results and get the unique? thank you in advance { "total_rows": 9, "offset": 0, "rows": [ { "id": "xxxx", "key": "12345", "value": { "_id": "abc123", "_rev": "4-8db4da81d1e20afcea0a328fb16e7ec8", "field1": "abc", "field2": "dfr" }, { "id": "xxxx", "key": "12345", "value": { "_id": "abc123", "_rev": "4-8db4da81d1e20afcea0a328fb16e7ec8", "field1": "abc", "field2": "dfr" }, ]

Reduce output must shrink more rapidly — Reducing to a list of documents

自古美人都是妖i 提交于 2019-12-12 02:35:53
问题 I have a few documents in my couch db with json as below. The cId will change for each. And I have created a view with map/reduce function to filter out few documents and return a list of json documents. Document structure - { "_id": "ccf8a36e55913b7cf5b015d6c50009f7", "_rev": "8-586130996ad60ccef54775c51599e73f", "cId": 1, "Status": true } Here is the sample map: function(doc) { if(doc.Key && doc.Value && doc.Status == true) emit(null, doc); } Here is the sample reduce: function(key, values,

CouchDB: Pre-filled fields when adding new documents?

自作多情 提交于 2019-12-12 01:57:30
问题 In the CouchDB GUI, when I add a new document the _id field is the only field that appears by default. I must manually click "Add field" for each other field I want to add. This gets repetitive when I know every document in that particular database needs those fields. Is it possible to customize a database, so that when I create a new document in that database it has more than the _id field by default? 回答1: I don't think it's possible to have predefined fields in CouchDB, I would probebly

couchdb futon document editor - can I customize the document validation part?

☆樱花仙子☆ 提交于 2019-12-11 10:17:29
问题 A VERY nice to have would be if I could edit object-literals in this editor's text-field instead of JSON expressions. If I could replace the JSON parse with a simple eval - it will make editing sooooo much easier! (and help me design document structures for my projects soooo much more easily) I mean, gosh!! it's not a protocol school, it's an editor's tool. The goal of the tool is not to teach me the protocol and comment me on every petty mistake, but to help me design documents for the

View active user sessions

老子叫甜甜 提交于 2019-12-11 04:36:58
问题 Is it possible to view a list of active user sessions on a couchdb server? There doesn't seem to be any mention of such a feature in the couch docs (http://docs.couchdb.org/en/2.0.0/api/server/authn.html#api-auth-session, http://docs.couchdb.org/en/2.0.0/api/index.html). I also can see nothing similar to what I require in Futon nor Fauxton UIs. 回答1: Is it possible to view a list of active user sessions on a couchdb server? Short answer: No. Long answer: There's no such thing, really, as user