Couchdb2 mango/find js api

603 Views Asked by At

I have noticed that all the couchdb api helpers don't implement Mango query

I have found cradle started working on it, but seems they stoped implementing, nothing on docs about it. https://github.com/flatiron/cradle/blob/master/lib/cradle/database/mango.js

Is there a good js api that supports mango find?

Secondary: Is there a reason why no one seems to be implementing mango query, why is everyone sticking to map/reduce?

Based on the comments give, I would like to clarify my question: I know about pouch-find, but I presume this is for local storage or local instance of pouch that could be found in browser or nodejs, but I want to find a library that I can use to query couchdb database on the server.

I have found a temporary solution for now. Im using cradle with query function ex:

db.query({
            method: 'POST',
            path: "/_find",
            body: {
                selector:{"_id": "settings/12345" },
                limit:1,
                //use_index: "_all_docs"
            }
        }

So to further explain my setup. Im using one couchdb per user. That db will sync to browser using pouchdb, I can use pouch-find to query that synced local copy (Is this correct?).

But then I have other couch databases that are not synced, that can be accessed by many users. To query these databases I use cradle with the above example.

1

There are 1 best solutions below

2
Alexis Côté On

You can find pouchdb-find here which is in development. If there is no api helpers for Mango Query yet, it's probably because it`s new altough cloudant had this query language since a moment.