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

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
  • 286
  • 2
  • 16
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
  • 7,104
  • 20
  • 81
  • 193
1
vote
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
  • 11
  • 2
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
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
  • 544
  • 3
  • 9
  • 26
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
  • 5,185
  • 5
  • 36
  • 51
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
  • 7,656
  • 12
  • 65
  • 136
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
  • 4,086
  • 5
  • 26
  • 39
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
  • 7
1
vote
1 answer

Pouchdb-find docs from the last 30 days

I'm trying to perform a $gte query on a PouchDB index I've created. The query doesn't error but returns an empty array when there should be documents that match the clause. The idea is to get all docs that have timestamps from the last 30 days. The…
Mark
  • 744
  • 1
  • 6
  • 21
1
vote
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
  • 719
  • 9
  • 20
1
vote
1 answer

Substring match on a field in json index

I want to be able to match a substring using a JSON index, but I can't seem to work out how to do it. I have a record in the data with a data.name property of A SIGN DESIGN PTY. LTD.. My index is defined as follows: db.index({ name:…
simon
  • 905
  • 1
  • 9
  • 15
1
vote
1 answer

Cloudant to CouchDB

We are developing an application which uses Cloudant as database, which is a variant of Couchdb. Cloudant started to become a bit expensive for us also not reliable because of the last issues. We have lost our connection to DBs for one day. So we…
iboware
  • 917
  • 1
  • 11
  • 23
1
vote
1 answer

Should I use selector or views in Cloudant?

I'm having confusion about whether to use selector or views, or both, when try to get a result from the following scenario: I need to do a wildsearch for a book and return the result of the books plus the price and the details of the store branch…
kkurni
  • 15
  • 1
  • 2