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

85 questions
1
vote
1 answer

index and query items in an array with mango query for cloudant and couchdb 2.0

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:…
Andrej
  • 316
  • 3
  • 7
0
votes
1 answer

How to write a mango filter on the size of an array?

I would like to find documents with a mango query by specifying the minimal and maximal size of an array property. Given a document with an array property customers. I'd like to be able to find all documents with the number of customers between 10…
Leevi L
  • 1,033
  • 7
  • 19
0
votes
1 answer

Why do CouchDB views support compaction but mango indexes do not?

As I was reading the CouchDB documentation I found it weird that views needed compaction while mango indexes did not. Are they not essentially the same thing and subject to the same requirement of cleaning out unused or old entries? It seems like an…
NiGHTS
  • 3
  • 2
0
votes
1 answer

Mango index "does not contain a valid index for this query" even when specified manually

I'm trying to efficiently query data via Mango (as that seems to be the only option given my requirements Searching for sub-objects with a date range containing the queried date value), but I can't even get a very simple index/query pair to work:…
David Sulc
  • 25,448
  • 3
  • 49
  • 52
0
votes
1 answer

CouchDB Mango query - Match any key with array item

I have the following documents: { "_id": "doc1" "binds": { "subject": { "Test1": ["something"] }, "object": { "Test2": ["something"] } }, }, { "_id": "doc2" "binds": { "subject": { "Test1":…
Marcelo Machado
  • 871
  • 1
  • 10
  • 27
0
votes
1 answer

Searching for sub-objects with a date range containing the queried date value

Let's say we're handling the advertising of various job openings across several channels (newspapers, job boards, etc.). For each channel, we can buy a "publication period" which will mean the channel will advertise our job openings during that…
David Sulc
  • 25,448
  • 3
  • 49
  • 52
0
votes
0 answers

Is it possible to get only the matched values?

Is it possible to take only the array from the JSON that matches with the criteria? This is my JSON: { "company": "myCompany", "customers": { "bob@test.com": [{ "email": "bob@test.com", "name": "Bob", "gender": "male" …
HectorCode
  • 185
  • 8
0
votes
0 answers

How to use CouchDB Mango query (/db/_find) with an index to select multiple _id keys

I am using CouchDB 3.1.1 to perform Mango queries against a database containing a large number of documents. A very common requirement in my application is to perform queries on a very specific and dynamic set of documents. From what I understand at…
NiGHTS
  • 3
  • 2
0
votes
0 answers

Sort record without using couch db indexing

I have few records in couch db, While retreiving those records i should get the result in a such a way that the latest rescord should be in the first. I searched for the solution but everything is based on using the indexing.I dont want to use the…
pooja
  • 15
  • 5
0
votes
1 answer

Read quorum in CouchDb for _find and MapReduce queries

The CouchDb documentation indicates that, by default, both reads and writes to single documents are quorum reads and writes (e.g. r=2 and w=2 in a 3-replica system). However, the documentation for _find says r "defaults to 1, in which case the…
Oliver Dain
  • 8,273
  • 3
  • 27
  • 43
0
votes
0 answers

Fetch Latest record based on timestamp using Couch DB selector query in node js

I have a record containing an array in which I have to fetch only the latest array based on the timestamp. I am using the couch db selector query to fetch the records. I am stuck in dragging the latest record alone. Please help me in getting the…
pooja
  • 15
  • 5
0
votes
1 answer

How to select a document if a field contains a substring

I've a movielens database and, for example, to search all the documents who have "Titanic" in the title i run this Mango query: { "selector": { "$or": [ { "Title": { "$regex": "titanic" } …
user7494712
0
votes
0 answers

Russian language in CouchDB

I try to run query in CouchDB 2.3.1 with russian language data using regex and get nothing: { "selector": { "class_name": "cat.patients", "name": { "$regex": "(?i)ИВАНОВА" } } } But this query works: { …
0
votes
1 answer

CouchDB - Mango Query to select records based on complex composite key

I have records with keys looking like this: "001_test_66" "001_testab_54" "002_testbc_88" "0020_tesgdtbc_38" How can I query a couchdb database using Mango queries based on the first part of the key (001 or 002). The fourth one should fail if I…
M Yil
  • 619
  • 8
  • 22
0
votes
1 answer

How to find by attribute starting with $

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":…