Questions tagged [couchdb-mango]

Simplified query language interface for Apache CouchDB, inspired by MongoDB, and made available on Cloudant service first, and then on Apache CouchDB 2.0.

"Mango" is a MongoDB inspired query language interface for Apache CouchDB. It is designed to provide users a more natural conversion to Apache CouchDB.

It is worth noting that it enables the creation of indexes (a.k.a. 'views'), without having to implement explicitly a map and a reduce functions.

The endpoint added is for the HTTP-URI pattern /dbname/_query and has the following characteristics:

  • the only HTTP method supported is POST,
  • the request Content-Type must be application/json,
  • the response is a single JSON object or array that matches to the single command or list of commands that exist in the request.

Reference: https://github.com/cloudant/mango

92 questions
1
vote
1 answer

Mango query on python 3.8

I'm trying to query a CouchDB database from Python and it works... but not entirely. So, I created a partitioned DB with partition for movies, ratings, and tags and every partition _id is "partitionName : id". Now I want to count the documents into…
user7494712
1
vote
1 answer

Retrieve document with an HTTP request CouchDB 3.0.0

I'm a beginner in CouchDB, and on the net I've read that is possible to run Mango queries with an HTTP request. I've tried hard, but I'm unable to rut queries like this. This is the command C:\>curl -X POST…
user7494712
1
vote
0 answers

Failed to fetch next results: QUERY_STATE_NEXT failed: transaction ID: XXXXX: no ledger context

I am trying to fetch data from blockchain using query in chaincode. I have invoked around 2,50,000 records in blockchain and trying to fetch the data using query. When I run the chaincode and get the peer logs, I am getting the below…
1
vote
1 answer

How to define an index to use in a Mango Query

I am trying to create a CouchDB Mango Query with an index with the hope that the query runs faster. At the moment I have the following Mango Query which returns what I am looking for but it's slow. Therefore, I assume, I need to create an index to…
Dogahe
  • 1,380
  • 2
  • 20
  • 50
1
vote
1 answer

How to fetch subset of attachments

I have a CouchDB with documents, which look like this: { "_id": "000040cc-e3b4-47cc-b051-a5508efb8996", "_rev": "1-882d7f88cc2e1e767b55d0c82fb638d2", "state": "uploaded", "state_since": "2020-02-17T11:20:55.1450252Z" // more metadata ... …
Ben
  • 4,486
  • 6
  • 33
  • 48
1
vote
1 answer

couchdb query/view on timestamp subfields

I have a couchdb document.. roughly like this (minimal) { "_id": "225136308d6f95611e457c0f02f1b47a769c35e8", "_rev": "19-f2affa088d817ec924c6ca03c34ef1bf", "communications": [ { "sequenceId": 1, "timestamp":…
baradhili
  • 514
  • 1
  • 7
  • 27
1
vote
1 answer

couchdb showing different record count with pagination?

I wanted to calculate how many records couchDB has for a database. So hit the below API and it returns json which has records count as well. GET http://localhost:20984/mydb/ jSON { "db_name": "mydb", "update_seq":…
TechChain
  • 8,404
  • 29
  • 103
  • 228
1
vote
1 answer

Can mango syntax take in two $OR operators in one query?

I have problems putting two $OR operations in one query statement. It ignores the earlier $OR operators and only takes into consideration the last $OR operator in the query. (There is no issue when only one $OR operator is in the query.) Am…
taffies
  • 11
  • 1
1
vote
2 answers

How to fetch records after a particular date

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", …
Priyanka
  • 117
  • 1
  • 5
  • 19
1
vote
1 answer

Couch DB Mango query to compare 2 fields from the same struct

I have 2 structs with different "_id" values. I want to get only the struct in which the "costCenterFrom" is not equal to "costCenterTo" { "_id": "TRAN001", "_rev": "3-945670849a142da8d57a79f7c13040dd", "actionCode": "Transfer", …
sasi
  • 836
  • 4
  • 17
  • 33
1
vote
2 answers

Search a list of keywords in CouchDB

I have documents containing lists of keywords. How can I query such that a search for e.g., the keywords bela and fleck returns only documents that have both of those keywords: { "_id": "track/bela-fleck/big-country", "title": "Big…
spiffytech
  • 6,161
  • 7
  • 41
  • 57
1
vote
1 answer

Creating a Mango query selector for element that do NOT match

I have a user like so: { "_id": "u88888", "_rev": "27-9f205fb7496645be2f3d717fff376d73", "name": "Test Testerson", "type": "user", "role": "boss", "training": [ { "id": "11111", "name": "training 1" }, { …
bryan
  • 8,879
  • 18
  • 83
  • 166
1
vote
0 answers

Performance Issue with CouchDB Mango Index

I'm working on a project that requires me to search a CouchDB database for an approximate match and then sort the results. I've decided to use the Mango query system because I don't know ahead of time what field and sort combo will be used. The…
1
vote
0 answers

CouchDB sort doesn't work

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". { …
pguetschow
  • 5,176
  • 6
  • 32
  • 45
1
vote
1 answer

Couchdb 2 _find query not using index

I'm struggling with something that should be easy but it's making no sense to me, I have these 2 documents in a database: { "name": "foo", "type": "typeA" }, { "name": "bar", "type": "typeB" } And I'm posting this to _find: { "selector": { …
Julian
  • 93
  • 1
  • 8