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
14
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
  • 2,701
  • 1
  • 24
  • 40
8
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
  • 123
  • 1
  • 6
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
  • 395
  • 7
  • 15
7
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,082
  • 11
  • 26
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
  • 7,656
  • 12
  • 65
  • 136
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
5
votes
1 answer

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…
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
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
  • 7,656
  • 12
  • 65
  • 136
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 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
  • 445
  • 4
  • 6
3
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
  • 166
  • 2
  • 10
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
  • 353
  • 2
  • 12
3
votes
2 answers

Is startkey pagination required for Mango queries in CouchDB 2.0

I've been searching all over on this one. I'm running CouchDB 2.0 and understand I have a choice to make between using traditional views or the newer Mango query when retrieving a set of data. So I'm currently using the Mango query syntax and…
2
votes
2 answers

Create view in CouchDB in a python application

I have a DB in CouchDB and I'm wondering if is it possible to create a view directly from python instead of using GUI. I'm a beginner in CouchDB and I need a function that's equivalent at SELECT DISTINCT in SQL and a view like function (doc) { …
user7494712
1
2 3 4 5 6