cloudant

how to sort date in cloudant query

痞子三分冷 提交于 2019-12-06 09:35:07
问题 i want to sort my data as par desc date in local cloudant query. i have insert_ts in my database document. my code for simple query is:- public List<BasicDocumentMAP> allTasksWithAllArg(Map<String, Object> query, int skip, int limit, List<String> fields, List<Map<String, String>> sortDocument) { int nDocs = this.sunDatastore.getDocumentCount(); QueryResult all = this.im.find(query, skip, limit, fields, sortDocument); List<BasicDocumentMAP> arrayListBasicDocumentMAP = new ArrayList<>(); //

Connection error while connecting to cloudant DB from local

风格不统一 提交于 2019-12-06 08:22:56
I am new to cloudant. I have written code to connect cloudant DB which is DBaas in bluemix. I have written code locally to connect cloudant DB. Below is the code try { user="4728f43d-fcd2-41f0-be63-8945a78a9dab-bluemix"; password="xxxxxxxxxxxxxxxx"; url="https://4728f43d-fcd2-41f0-be63-8945a78a9dab-bluemix:xxxxxxxxxxxxxxxx@4728f43d-fcd2-41f0-be63-8945a78a9dab-bluemix.cloudant.com"; System.setProperty("http.proxyHost", "9.184.9.13"); System.setProperty("http.proxyPort", "80"); //user="8452e722-8945-47d9-b372-ede45e55a7a7-bluemix"; //password="xxxxxxxxxxxxxxxx"; //url="https://8452e722-8945-47d9

How can I securely connect to Cloudant using PouchDB?

人盡茶涼 提交于 2019-12-06 07:13:44
问题 I am creating a mobile app for Android and iOS using Cordova/PhoneGap and am using IBM's Cloudant database for storage. I am using the PouchDB javascript library to access the Cloudant database. Currently I have this code to access it... db = new PouchDB('https://[myaccount].cloudant.com/[mydb]', { auth: { username: 'myusername', password: 'mypassword' } }); I am aware that this is extremely insecure, and am wondering if there is a more secure way to connect to my database from within the app

How to index multidimensional arrays in couchdb

ⅰ亾dé卋堺 提交于 2019-12-06 04:09:25
I have a multidimensional array that I want to index with CouchDB (really using Cloudant). I have users which have a list of the teams that they belong to. I want to search to find every member of that team. So, get me all the User objects that have a team object with id 79d25d41d991890350af672e0b76faed. I tried to make a json index on "Teams.id", but it didn't work because it isn't a straight array but a multidimensional array. User { "_id": "683be6c086381d3edc8905dc9e948da8", "_rev": "238-963e54ab838935f82f54e834f501dd99", "type": "Feature", "Kind": "Profile", "Email": "gc@gmail.com",

How to count the documents returned by a Mango query

久未见 提交于 2019-12-06 04:08:44
I have a mango query: { "selector": { "age":{ "$eq": 22 } } } I want to know the number of documents that satisfy this criteria. I know we can use map reduce functions to achieve this, but is there any way to do this by using mango query like using some key like "count" in the query itself as we do for "sort", and "fields". I am firing mango query through rest client and I want the number of documents as the response of the query. It is not really possible to retrieve the full number of documents by using the find function. By default _find is limited to 25 documents to be returned ( http:/

Cloudant: No index exists for this sort, try indexing by the sort fields

别来无恙 提交于 2019-12-04 19:24:09
I have a problem that persists for a few days and I cannot solve it. I have a simple document in my database which looks like this: { "_id": "asd123", "_rev": "revidasd123", "type": "CUSTOM_TYPE", "position": 8, "title": "Short custom title" } When I try to make a sort by position , even if I have created an index for this field, I always get the same error: Error: no_usable_index. Reason: No index exists for this sort, try indexing by the sort fields . Here is the index: { "type": "json", "def": { "fields": [ { "position": "asc" } ] } } And here is my query which cause this error: { "selector

how to sort date in cloudant query

萝らか妹 提交于 2019-12-04 15:29:49
i want to sort my data as par desc date in local cloudant query. i have insert_ts in my database document. my code for simple query is:- public List<BasicDocumentMAP> allTasksWithAllArg(Map<String, Object> query, int skip, int limit, List<String> fields, List<Map<String, String>> sortDocument) { int nDocs = this.sunDatastore.getDocumentCount(); QueryResult all = this.im.find(query, skip, limit, fields, sortDocument); List<BasicDocumentMAP> arrayListBasicDocumentMAP = new ArrayList<>(); // Filter all documents down to those of type Task. for (DocumentRevision rev : all) { }} please help me to

Why there is no all_or_nothing support in Cloudant?

自古美人都是妖i 提交于 2019-12-04 05:02:58
问题 I tried to make an atomic bulk documents update with all_or_nothing set to true on Cloudant, but got the following response: [{"id":"7b75974f73c4230047b96b5272b696fd","rev":"1-e9b78ecba4c4ac29a9743cd001219eae","error":"not_implemented","reason":"all_or_nothing is not supported yet"}, {"id":"921faa913230839614a4feb19d5c39ec","rev":"0-","error":"not_implemented","reason":"all_or_nothing is not supported yet"}] I followed CouchDB documentation because Cloudant is a fork of CouchDB and for most

Can I restrict unauthenticated users from accessing _all_docs?

心不动则不痛 提交于 2019-12-03 09:30:13
问题 I'd like people to be able to share documents privately, using a link with a random id, like I get after posting a private link to a pastebin. I want to know both for CouchDB and Cloudant in general. 回答1: With Apache CouchDB, read permission is per-database , not per-document. If a user can fetch a document from a database, the user can fetch _all_docs?include_docs=true too. I wrote details in this question about CouchDB read authorization. There are a few approaches: Layer-7 firewall or

No matched schema for {“_id”:“…”,“doc”:{…}

二次信任 提交于 2019-12-02 19:41:06
问题 When using the SDP to extract data from Cloudant and populate dashDB, I occasionally see error messages in the dashdb "XXXX_OVERFLOW" table that look like this: No matched schema for {"_id":"...","doc":{...} Questions What does this error mean? How can I fix it? 回答1: There are two main phases to the SDP process: Schema analysis Data import In the schema analysis phase, the SDP analyses a sample of documents in Cloudant and uses the document structures of the sample to infer the target schema