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
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
2
votes
0 answers

CouchDB and PouchDB are producing duplicate records when recreating same CouchDB from scratch with a script

We have a couch DB we are developing on. We have a script that, for development purposes, just recreates the couch database from some json files from scratch every time we run that script. All the data we are inserting into couch from this script…
2
votes
0 answers

How to pick one nested element from array in couchDb selector?

I'm trying to write a filter to replicate the data to another CouchDB server. As part of filter, I would like to pick only certain parts of the document, based on the filter. The fields in Selector can fetch the root nodes, but how can I pick nested…
TND
  • 21
  • 2
2
votes
1 answer

CouchDB mango ignoring index sort order

I am using Hyperledger Fabric with CouchDB (version 2.2.0, the one that comes with the hyperledger/fabric-couchdb docker image). There is a limitation on Fabric which does not allow to specify sort array for mango queries, so it has to be done with…
Victor Machado
  • 230
  • 3
  • 11
2
votes
0 answers

What are the performance implications of storing a large amount of documents in one database vs splitting them between various databases?

I am working on a project that utilizes CouchDB with around 20 different databases. Due to the limitations for querying separate databases, I am considering consolidating these all into one database. However, I have a strong feeling that this might…
2
votes
1 answer

CouchDB index with $or and $and not working but just $and does

For some reason, I have the following .find() commands and I am getting conflicting indexing errors. Below are examples of one working when I only try to get one type of document. But then if I try to get 2 types of documents it doesn't work for…
bryan
  • 8,879
  • 18
  • 83
  • 166
2
votes
1 answer

How to Search Revs in PouchDB Query

Both PouchDB and Mango seem to be missing an option to include previous versions of a document in an index query. Such an options might look something like: include_revs: true So, for example, to retrieve a list of all the versions of a user's…
R J
  • 4,473
  • 2
  • 22
  • 29
2
votes
2 answers

Cloudant/Mango selector for deeply nested JSONs

Let's say some of my documents have the following structure: { "something":{ "a":"b" }, "some_other_thing":{ "c":"d" }, "what_i_want":{ "is_down_here":[ { "some":{ …
zlr
  • 789
  • 11
  • 22
2
votes
1 answer

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

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 'studentsand 'courses: // Students table | Student ID | Student Name | XYZ1 | Zach // Courses…
Zach Smith
  • 8,458
  • 13
  • 59
  • 133
1
vote
1 answer

CouchDB query no index exists for this sort error

I have seen already this question a lot of times, yet here I am asking same question. Why do I get this error: Error running query. Reason: (no_usable_index) No index exists for this sort try indexing by the sort fields. I am running a blockchain…
Rafail K.
  • 365
  • 3
  • 14
1
vote
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
  • 1,179
  • 2
  • 13
  • 33
1
vote
1 answer

Apply a filter on array field of couchDB

I'm working on Hyperledger fabric. I need a particular value from array not a full document in CouchDB. Example { "f_id": "1", "History": [ { "amount": "1", "contactNo": "-", "email": "i2@mail.com" }, { …
1
vote
1 answer

Map/reduce in CouchDB take a field if id contains a subString

I'll explain: I have this function function (doc) { if(doc.MovieId == "1721") emit(doc.Rating, 1); } but it return me some document that are not relevant (for example they haven't the Rating field). My document _id is composed of…
user7494712
1
vote
1 answer

Unable to run a Mango query

This is my query: { "selector": { "_id": { "$regex": "^rati" //need to find all documents in ratings partition } }, "fields": [ "MovieID", "UserId", "Rating" ], "limit": 10, "sort": [ …
user7494712