couchdb

GeoCouch query badmatch error

半腔热情 提交于 2019-12-25 02:14:27
问题 After installing Couchbase Single Server Community Edition fonr Windows, and following the instructions for "Using Geocouch" i've found in the readme from couchbase/geocouch Github, I only get the error: {"error":"{{badmatch,{ok,11780}},\n [{vtree_bulk,omt_write_tree,4},\n {vtree_bulk,omt_write_tree,2},\n {vtree_bulk,bulk_load,4},\n {vtree,add_remove,5},\n {couch_spatial_updater,'-write_changes/4-fun-2-',5},\n {lists,zipwith,3},\n {couch_spatial_updater,write_changes,4},\n {couch_spatial

Perform sort on field that's not primary index

隐身守侯 提交于 2019-12-25 01:19:44
问题 Error: No index exists for this sort, try indexing by the sort fields. I've tried creating indexes on anotherValue , _id+anotherValue , but no difference. This is my query: { "selector": { "_id": { "$gt": null }, "$or": [ { "_id": "10" }, { "value": "10", "anotherValue": "1234" }] }, "sort": [{"anotherValue": "desc"}] } Indexes setup: Your available Indexes: special: _id 回答1: Try adding a desc index on anotherValue: { "index": { "fields": [ {"anotherValue":"desc"} ] }, "type": "json" } and

Is it possible to get the latest seq number of PouchDB?

血红的双手。 提交于 2019-12-25 00:43:15
问题 I am trying to cover for an issue where CouchDB is rolled back, causing PouchDB to be in the future. I want to find a way to detect this situation and force PouchDB to destroy and reload when this happens. Is there a way to ask PouchDB for it's current pull seq number? I am not able to find any documentation at all on this. My google-foo is not strong enough. So far my only thought is to watch the sync.on(change) feed, and record the seq number on every pull. Then on app reload, run this as

couchdb validation based on content from existing documents

风格不统一 提交于 2019-12-24 18:17:47
问题 QUESTION Is it possible to query other couchdb documents as part of a standard couchdb validation function ? If not, what is the standard approach for including properties of other documents as part of a validation rule inside a couchdb validation function? RATIONALE Consider a run-of-the-mill address book application where the validation function is intended to prevent two or more entries having the same value for the 'e-mail' in one of the address book entry fields. Consider also an address

Couchdb Upload Image via Httpclient

大兔子大兔子 提交于 2019-12-24 18:06:19
问题 I build An Android app with couchdb , i tried to uploaded image to the couchdb document with this function: public JSONObject uploadPicture(PutAttachment putAttachment) { JSONObject obj = null; try { HttpClient httpclient = new DefaultHttpClient(); HttpPut httpPut = new HttpPut(baseUrl() + putAttachment.getDbName() + "/" + putAttachment.getDocName() + "/attachment?rev=" + putAttachment.getRev()); ByteArrayEntity img = new ByteArrayEntity(putAttachment.getByteImg()); httpPut.setEntity(img);

SCP (Security Content Policy) issue with pouchdb

烈酒焚心 提交于 2019-12-24 18:04:08
问题 I see an error in the console when running my ionic app on my android device: Refused to connect to 'blob:http%3A//192.168.0.12%3A8100/9d72a06a-c6fa-4397-976c-41ea23f90be0' because it violates the following Content Security Policy directive: "default-src *". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback. i @ pouchdb.min.js:9 (index):28 Uncaught SecurityError: Failed to execute 'open' on 'XMLHttpRequest': Refused to connect to 'blob:http%3A//192.168.0

SCP (Security Content Policy) issue with pouchdb

北战南征 提交于 2019-12-24 18:04:07
问题 I see an error in the console when running my ionic app on my android device: Refused to connect to 'blob:http%3A//192.168.0.12%3A8100/9d72a06a-c6fa-4397-976c-41ea23f90be0' because it violates the following Content Security Policy directive: "default-src *". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback. i @ pouchdb.min.js:9 (index):28 Uncaught SecurityError: Failed to execute 'open' on 'XMLHttpRequest': Refused to connect to 'blob:http%3A//192.168.0

How to group entries by year and month using CouchDB?

半腔热情 提交于 2019-12-24 17:42:11
问题 The view function below is used to emit some entries: function(doc) {emit(null,{"date":doc.date,"title":doc.title,"txt":doc.txt});} {"total_rows":7,"offset":0,"rows":[ {"id":"67ebe3755be4edf5c4edf0d96f0023eb","key":null,"value":{"date":"Dec 12,2012","title":"test1","txt":"this is just a test"}}, {"id":"67ebe3755be4edf5c4edf0d96f003120","key":null,"value":{"date":"Nov 11,2012","title":"test2","txt":"this is just a test2"}}, {"id":"67ebe3755be4edf5c4edf0d96f003869","key":null,"value":{"date":

How to group entries by year and month using CouchDB?

独自空忆成欢 提交于 2019-12-24 17:41:29
问题 The view function below is used to emit some entries: function(doc) {emit(null,{"date":doc.date,"title":doc.title,"txt":doc.txt});} {"total_rows":7,"offset":0,"rows":[ {"id":"67ebe3755be4edf5c4edf0d96f0023eb","key":null,"value":{"date":"Dec 12,2012","title":"test1","txt":"this is just a test"}}, {"id":"67ebe3755be4edf5c4edf0d96f003120","key":null,"value":{"date":"Nov 11,2012","title":"test2","txt":"this is just a test2"}}, {"id":"67ebe3755be4edf5c4edf0d96f003869","key":null,"value":{"date":

How to check if database already exists

放肆的年华 提交于 2019-12-24 17:07:08
问题 I am writing a small Python program that loads some documents into couchdb. It would be very convenient to check whether a database with a certain name already exists, so I can either create a new one or open the existing one. What I want to do is something like this: import couchdb def connect(url, dbName): server = couchdb.Server(url) if dbName exists: # how do I do this? return server[dbName] else: return server.create(dbName) I know a try-except block would do the trick, but isn't there a