couchdb

Android - Couchbase lite - pull with filter - Replication.setFilter

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 12:58:50
问题 I'm working on a android messagerie app, messages are stored in a CouchDB(Apache) database on the internet. How can I pull messages with filter on my Android devices? Android Snippet: Replication pull = new Replication(messageDB, messageUrl, Replication.Direction.PULL); //filter pull.setFilter("message/by_username"); HashMap<String, Object> filterParams = new HashMap<>(); filterParams.put("username", usr); pull.setFilterParams(filterParams); pull.setContinuous(false); //oneshot pull.start();

How do you delete a couchdb document with an empty “” document id?

依然范特西╮ 提交于 2019-12-23 12:26:01
问题 I see the document in the db as this: {_id: "", _rev: "1-2f11e026763c10730d8b19ba5dce7565", forbidden: "must supply latest _rev to update existing package"} Everything I see in the docs shows referring to the document with the ID, but of course this can't happen. I'm not exactly sure how this happened, most likely something faulty between the chair and keyboard, but I wanted to know if there was a possibility of fixing this without starting over. 回答1: There is a bug in CouchDB that allows

update_sequence changed semantics in cloudant db?

不羁岁月 提交于 2019-12-23 12:25:55
问题 I use a cloudant couchdb and I've noticed see that the "_changes" query on the database returns an "update_sequence" that is not a number, e.g. "437985-g1AAAADveJzLYWBgYM..........". What is more, the response is not stable: I get 3 different update_sequences if a query the db 3 times. Is there any change in the known semantics of the "update_sequence", "since", etc. or what? Regards, Vangelis 回答1: Paraphrasing an answer that Robert has previously given: The update sequence values are opaque.

CouchDB: how to use _revs_diff to get document revision ID

半腔热情 提交于 2019-12-23 10:15:54
问题 I tried to test couchDB's _revs_diff api to get document revisions. Here is the command I used curl -X POST http://******:******@localhost:5984/grocery-sync/_revs_diff -H "Content-type:application/json" the result is {"error":"unknown_error","reason":"badarg"} Does anyone know the reason for that? 回答1: According to the CouchDB wiki page, _revs_diff will return a value if the revisions for a given document are invalid. No examples using curl are given. Looking at this mailing list posting the

CouchDB学习-集群管理

余生长醉 提交于 2019-12-23 10:13:32
官方文档 集群管理 小说网 https://www.guxs.net/ 理论 在 etc/fefault.ini 文件中有以下部分: [cluster] q=8 n=3 q - 分片的数量 n - 每一份文档的拷贝数量(加上原文档一共几份副本) 创建数据库时可以通过覆盖该值修改为自己的值。 在集群操作中,获取操作中CouchDB返回状态码200或者是写操作返回状态码201即为大多数成员达成一致。大多数成员定义为相关拷贝的数量的一半。对于“读写”操作,“相关副本”的定义稍有不同。 对于读操作,相关副本的数量是保存请求数据的当前可访问分片的数量,这意味着在发生故障或网络分区的情况下,相关副本的数量可能少于集群中的副本数量。 可以使用r参数设置读取份数。 对于写操作,相关副本的数量始终为n,即集群中的副本数量。 对于写操作,可以使用w参数设置份数。 如果少于此数量的可用节点,则返回202。 节点管理 查看所有节点 curl -u admin:adminpw -X GET http://localhost:5984/_membership { "all_nodes":[ # 当前节点所知道的节点 "node1@xxx.xxx.xxx.xxx"], "cluster_nodes":[ #当前节点所连接的节点 "node1@xxx.xxx.xxx.xxx"], } 添加一个节点 curl -u

In CouchDB shows, what does 'this' refer to?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 09:36:18
问题 I'm trying to understand CouchDB and couchapp, and as I'm going through I'm seeing a dearth of the use of 'this' in any given context. I understand that show objects get the document and the request, and are allowed to operate on them with lists and views. These operations are all Javascript objects. But CouchApp also seems to store, as strings, all sorts of things: README files, Mustache templates, and so on. It must have access to them somehow. Does the this operator in the context of a

couchdb: map in design document gives compilation_error

两盒软妹~` 提交于 2019-12-23 08:47:49
问题 I use Couchdb 1.1.1 in Debian testing and I have this design document in database { "_id": "_design/Page", "_rev": "9-1944cdebabf20ae569eab7b534b43e67", "views": { "all": { "map": "function(doc) {}" } }, "language": "javascript" } but still I get in http://localhost:5984/db_development/_design/Page/_view/all this {"error":"compilation_error","reason":"Expression does not eval to a function. ((new String(\"function(doc) {}\")))"} I tried to run different simple map functions in spidermonkey

CouchDB and multiple keys

房东的猫 提交于 2019-12-23 08:29:08
问题 Is it possible to use similiar query in CouchDB? Like use two keys ? SELECT field FROM table WHERE value1="key1" OR value2="key2" I was always using only one key. function(doc) { emit(doc.title, doc); } Thank you. 回答1: In CouchDB 0.9 and above you can POST to a view (or _all_docs) with a body like: {"keys": ["key1", "key2", ...]} In order to retrieve the set of rows with the matching keys. 回答2: Yes. Something like this should do the trick if I understand your question: function(doc) { a =

How to upload an image with flask and store in couchdb?

南楼画角 提交于 2019-12-23 05:48:04
问题 A previous question asks how to retrieve at attachment from couchdb and display it in a flask application. This question asks how to perform the opposite, i.e. how can an image be uploaded using flask and saved as a couchdb attachment. 回答1: Take a look at the example from WTF: from werkzeug.utils import secure_filename from flask_wtf.file import FileField class PhotoForm(FlaskForm): photo = FileField('Your photo') @app.route('/upload/', methods=('GET', 'POST')) def upload(): form = PhotoForm(

couchapp does not generate loader.js

狂风中的少年 提交于 2019-12-23 05:44:07
问题 I'm trying to use couchapp to manage my CouchDB application, but it's missing a crucial file after generating the project, loader.js . It looks like this is an existing issue (for the last 6 months) that hasn't been addressed by the couchapp team. I first tried to upgrade the vendor folder, but this didn't work: couchapp vendor update git://github.com/couchapp/vendor.git 2012-02-13 22:57:50 [CRITICAL] vendor `git://github.com/couchapp/vendor.git` doesn't exist Traceback (most recent call last