couchdb-mango

How to find by attribute starting with $

旧城冷巷雨未停 提交于 2020-01-24 00:36:10
问题 I try to query couchdb server with _find endpoint by attribute, starting with '$' ($ref in my case). But server always returns empty document set. I have couchdb documents like this: { "_id": "59bb208006149f50bb32f76f4900ccfa", "_rev": "1-99022821cc2bb3ab0bdd84ab98b55828", "contents": { "eClass": "auth#//User", "name": "SuperAdminUser", "roles": [ { "eClass": "auth#//Role", "$ref": "59bb208006149f50bb32f76f4900c962?rev=1-24d9469afe50f162e473b09fdbd95154#/" } ], "email": "admin@mydomain.ru", }

CouchDB Full Text Search

左心房为你撑大大i 提交于 2020-01-05 02:24:11
问题 i need some direction about full text search in couchdb. Is it already enabled by default in 2.0, or do we have to rebuild couchdb enabling it? Scenario: It is a document management system, documents are shown in a grid. I need to be able to sort results. After several changes from map reduces to elastic indexes, now i am trying to use mango queries. Problem is that sorting does not give the expected results. { "selector": { "directoryName": { "$eq": "mail\\test\\inbox" }}, "sort": [{"subject

Couchdb, Mango queries and Indexes

≡放荡痞女 提交于 2019-12-30 07:14:14
问题 I use Mango queries with Couchdb when users want to search the database. They can search by multiple fields in the document. To simplify I have a document with three fields all of which can be searched to find the document. FieldOne: cow FieldTwo: pig FieldThree: dog When creating a mango index for the query what fields should I use? Should I create and index with multiple fields? Does the order matter? There are also three different document types (A, B C) defined in a field. I only need to

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

How to fetch records after a particular date

。_饼干妹妹 提交于 2019-12-11 20:29:55
问题 I am trying to fetch the records that has the " effectiveDateOfAction " field greater than Oct'2017. Please find the below 3 records. { "_id": "TRAN001", "_rev": "13-59a53069c1ebd6ecfc23ca1dea0ba28f", "effectiveDateOfAction": "10-30-2018", "employeeName": "Kumar,Vinoth", "transferReportID": "TRAN001", "~version": "76:0" } { "_id": "TRAN001", "_rev": "12-c320c61168f5d6d020f971124cb395f2", "effectiveDateOfAction": "05-10-2018", "employeeName": "Vinoth", "transferReportID": "TRAN002", "~version"

How to check for duplication before creating a new document in CouchDB/Cloudant?

北城余情 提交于 2019-12-11 14:26:28
问题 We want to check if a document already exists in the database with the same fields and values of a new object we are trying to save to prevent duplicated item. Note: This question is not about updating documents or about duplicated document IDs, we only check the data to prevent saving a new document with the same data of an existing one. Preferably we'd like to accomplish this with Mango/Cloudant queries and not rely on views. The idea so far is: 1) Scan the the data that we are trying to

Can you implement document joins using CouchDB 2.0 'Mango'?

我的未来我决定 提交于 2019-12-11 01:58:43
问题 From previous work on CouchDB 1.6.1, I know that it's possible to implement document joins in a couple ways: For example, with a simple schema of 'students and 'courses : // Students table | Student ID | Student Name | XYZ1 | Zach // Courses table | Course ID | Student ID | COURSE1 | XYZ1 This SQL query: SELECT [Student Name], [Course ID] FROM Students RIGHT OUTER JOIN Courses ON Students.[Student ID] = Courses.[Student ID] Could be implemented in CouchDB 1.6 with a map function: // Map

How to count the documents returned by a Mango query

不羁岁月 提交于 2019-12-07 15:29:20
问题 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. 回答1: It is not really possible to retrieve the full number of

CouchDB sort doesn't work

让人想犯罪 __ 提交于 2019-12-06 15:16:11
问题 I recently started using CouchDB but I have no success with the sort-option using mango query. My database is a simple person dataset and for this example I'd like to show all documents with the type "person" and sort it by the "firstName". { "selector": { "type": "person" }, "sort" : ["firstName"] } But it doesnt work. I just get the documents without any particular order. This is the list of my indexes: special: _id json: gender json: firstName json: lastName Is there something I forgot?

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:/