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
20
votes
3 answers

Couchdb Mango Performance vs Map Reduce Views

I've just noticed that in the release notes of Couchdb 2.0, it is mentionned that Mango queries are recommended for new applications. It is also mentionned that apparently Mango indexes are from 2x to x10 faster than javascript queries which really…
tobiak777
  • 3,175
  • 1
  • 32
  • 44
10
votes
2 answers

How to count the documents returned by a Mango query

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…
QO23
  • 143
  • 1
  • 8
8
votes
1 answer

Can $in / $or queries use indexes?

I'm playing with Mango queries on a CouchDB 2.0 instance, through the fantastic pouchdb-find. A few times I got the dreaded no matching index found, create an index to optimize query time warning even though I was using indexed fields. Just now I…
Ronan Jouchet
  • 1,303
  • 1
  • 15
  • 28
7
votes
0 answers

Couchdb 2.0 /db/_find total rows count for pagination

I post request (use python requests lib) with json data: json_data = { "selector": { "year": {"$gt": 2010} }, "fields": ["_id", "_rev", "year", "title"], "sort": [{"year": "asc"}], "limit": 10, "skip": 10 …
pirr
  • 445
  • 1
  • 8
  • 15
6
votes
2 answers

CouchDB indexes to connect the dots between documents

I have the following documents: { _id: "123", type: "project", worksite_id: "worksite_1" } { _id: "456", type: "document", project_id: "123" } { _id: "789", type: "signature", document_id: "456" } My goal is to run a query and to inevitably do a…
bryan
  • 8,879
  • 18
  • 83
  • 166
6
votes
2 answers

How to fetch unlimited documents using Mango query couchDB without providing "limit" field?

I am using Mango query in couch db for almost every query to find the documents. Here I am facing a problem in fetching all the documents matching the given conditions. The problem is that the default limit of mango query is 25 (means fetch 25…
6
votes
1 answer

Mango search in Arrays

My document has a structure like this: { "Calibration": { "Presettings": { "Date": [ { "Value": "2016-09-02 10:11", "Type": "generated" }, { "Value": "2016-09-05", "Type":…
rolfn
  • 163
  • 1
  • 4
4
votes
2 answers

How to define a _find query in couchdb mango with field names that start with dollar sign ($)

Many years ago we launched a project to manage semi-structured information for research projects. We used CouchDB, and at that time it was convenient for us to call the mandatory fields of entries starting with a dollar sign ($) {"id": 123, "$type":…
4
votes
1 answer

Mango Queries on a value that doesn't exist

I want to be able to search my documents for every item that either doesn't have the item hidden in it, or if it does, only grab it if it's not equal to true. Is this possible? I have the following selection and I am getting a bad query…
bryan
  • 8,879
  • 18
  • 83
  • 166
4
votes
0 answers

No index exists while trying to sort using an indexed field (Mango Queries)

I'm not sure how to figure out how to sort my documents using a Mango query. Any help would be greatly appreciated: I do the following find query and get the following error: return db.find({ sort: ['timestamp'], selector: {$and:…
bryan
  • 8,879
  • 18
  • 83
  • 166
4
votes
1 answer

Couchdb Mango Query selector on object in array of objects

I have a couch db filled with entries in this form { ... "templates" :[ {"template_id":"1"} {"template_id":"2"} {"template_id":"3"} ] } I am trying to write a mango query that will find all entries that have templates that…
james.c.funk
  • 465
  • 4
  • 8
4
votes
1 answer

Couchdb, Mango queries and Indexes

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:…
R.Meredith
  • 184
  • 2
  • 10
4
votes
2 answers

CouchDB Full Text Search

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…
3
votes
1 answer

CouchDB Mango Query - Match value with array item

If I have documents like so, is there a mango query that I can use to find all documents where the uid in the signatures array matches the uid in the root document? { _id: "1", uid: "12345", signatures: [ { uid: "12345" } ] }, { _id:…
bryan
  • 8,879
  • 18
  • 83
  • 166
3
votes
1 answer

CouchDB Mango Queries (CouchDB 2.0.1)

I am trying to query the following data: (obtained from:https://dotnetcodr.com/2017/06/21/introduction-to-couchdb-with-net-part-17-starting-with-mango-queries/) { "post_code": 35801, "country": "United States", …
jlb333333
  • 371
  • 2
  • 13
1
2 3 4 5 6 7