Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Support mango queries #300

Open
Open

Description

@henridwyer

CouchDB 2 has a new way to query the database without using views:

Perhaps this could be implemented as two new database functions:

  • mango_query
  • mango_index

Activity

  1. djc commented on Aug 14, 2016

    @djc
    Owner

    Hey, thanks for the notice. I haven't installed CouchDB 2 yet, but will likely do so soon after release. Still, I'm not sure adding APIs for Mango will be a high priority for me, personally, so it would be great if you're able to contribute some code towards this goal.

  2. adrian-the-git commented on Sep 29, 2016

    @adrian-the-git

    Just thought I'd chime in that without some mango support, there will be no way to perform a query without creating a view, as they've removed temporary views in favor of this new json-based query system.

  3. danballance commented on Nov 2, 2016

    @danballance

    I'm new to CouchDB and this project but I'm looking at trying to add these new functions mango_query and mango_index. If I have any success I'll submit a pull request.

  4. mraygalaxy commented on Jun 25, 2017

    @mraygalaxy

    Honestly, this was really dead simple to monkeypatch:

    _, _, data = db.resource.post_json('_find', body={"selector" : query}, headers = {'Content-Type': 'application/json'})
    return data["docs"]

    Almost nearly a one-liner. Anybody wanna make a PR?

  5. pirr commented on Sep 25, 2017

    @pirr

    Maybe like in django:
    For example:

    data1 = db.find(field__eq='A', limit=50)
    data2 = db.find(Q(field__eq='A')
                    & (Q(field1__subfield1__in=['lama', 'amal'])
                        | Q(field2__subfield2__regex ="foo")), limit=40, fields=['field1', 'field2'])
    

    I have implementation of this. If it is acceptable, I can provide my implementation.
    Q obj - https://github.com/pirr/alt_couch/blob/c690771f729c38ac39041d4fea981b44623a0748/_libs/vb/couch.py#L14
    find method - https://github.com/pirr/alt_couch/blob/c690771f729c38ac39041d4fea981b44623a0748/_libs/vb/couch.py#L222
    Sorry for my terrible english.

  6. djc commented on Sep 26, 2017

    @djc
    Owner

    I would like to add an implementation to CouchDB-Python. If you can provide one that fits into the library and has comments in English, I could probably review it.

  7. pirr commented on Sep 27, 2017

    @pirr

    I added filter method (mango query) with comments:
    pirr@6f051bc

  8. djc commented on Sep 27, 2017

    @djc
    Owner

    Looks pretty good, do you want to do a pull request for this?

  9. pirr commented on Sep 27, 2017

    @pirr

    #324 this is my first pool reguest. If there are comments, please, I will correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions