djc / couchdb-python

Python library for working with CouchDB
Other
202 stars 86 forks source link

Mango in CouchDB 2.0 #316

Closed tammoippen closed 7 years ago

tammoippen commented 7 years ago

I want to use CouchDB 2 in a private project and plan to use the new mango queries. Here I implemented the wrappers for the new endpoints:

Further, I added the _selector filter in the changes method.

I wrote tests for the new methods, but since they only work for CouchDB >= 2.0.0. I skip those test in case CouchDB < 2.0.0.

Finally, I needed to change the http::Resource::_request method to allow multiple path elements in a request (for remove_index).

Should solve #300 and partly #306 .

danballance commented 7 years ago

This looks great to me from reading the code. I've not got time right now to test it, but I'd definitely support what this PR is trying to achieve. I did something similar in a fork for my project but never found the time to get the tests together and for that reason haven't sent in a PR. I'd happily switch to this though and drop my fork :+1:

tammoippen commented 7 years ago

@djc Are there still changes requested, that I overlooked? Is there something holding this PR back?

djc commented 7 years ago

The only changes I'd like to have done or a bit meta; rearranging your commits so that they make a logical series of commits (that is, without things like "Apply requested changes" or "Revert unwanted changes"). I was going to do this myself, but if you are up for it you don't have to wait for me. I've been very busy the past weeks, which is why I haven't gotten to it, but I expect to merge it by next week if redoing the commits is up to me. (I can give a bit more detail if you want to do it.)

tammoippen commented 7 years ago

I can do that.

tammoippen commented 7 years ago

@djc Done.

djc commented 7 years ago

Thanks! I swizzled it a little more (mostly allocating some of the random bits and pieces from your last commit to earlier commits) and pushed it to master. Would it be convenient for you if I push this as a release?

tammoippen commented 7 years ago

@djc I am good with working with master for now. When I run into more 2.0 related issues (I know of some already), I will eventually provide PRs (if time permits).

djc commented 7 years ago

Cool, looking forward to it!

vvasuki commented 7 years ago

sudo pip install git+https://github.com/djc/couchdb-python@master does not update my copy of client.py with these wonderful additions I see in the latest version.. Any idea why?

djc commented 7 years ago

Not really. Are you loading the correct copy of the library into your application? Maybe ask the pip folks about it.