benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 114 forks source link

Fix typo: start_docid -> startkey_docid & end_docid -> endkey_docid #160

Closed skorobkov closed 1 year ago

skorobkov commented 7 years ago

According to docs (and my tests) CouchDB uses parameters startkey_docid & endkey_docid. https://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options http://docs.couchdb.org/en/2.0.0/api/ddoc/views.html

benoitc commented 7 years ago

couchbeam needs to support the 1.x version of couchdb also. Maybe could you just add a case for this new and disturbing api added to couchdb 2 ?

skorobkov commented 7 years ago

But 1.6.1 version has the same parameters (endkey_docid & startkey_docid) http://docs.couchdb.org/en/1.6.1/api/ddoc/views.html And bigcouch (0.4.2) which based on couchdb 1.1.1 has the same syntax:

$ curl -X GET "http://127.0.0.1:5984/"
{"couchdb":"Welcome","version":"1.1.1","bigcouch":"0.4.2"}

$ curl -X GET "http://127.0.0.1:5984/test-db/_design/test_view/_view/key1"
{"total_rows":8,"offset":0,"rows":[
{"id":"39d042f19a7052f8b0ee093e8b617218","key":1,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b617aa1","key":1,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b6194d6","key":1,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b61af73","key":1,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b61bc96","key":2,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b61d87b","key":2,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b61e67d","key":2,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b61ec89","key":2,"value":null}
]}

$ curl -X GET "http://127.0.0.1:5984/test-db/_design/test_view/_view/key1?key=1"
{"total_rows":8,"offset":0,"rows":[
{"id":"39d042f19a7052f8b0ee093e8b617218","key":1,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b617aa1","key":1,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b6194d6","key":1,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b61af73","key":1,"value":null}
]}

$ curl -X GET "http://127.0.0.1:5984/test-db/_design/test_view/_view/key1?key=1&startkey_docid=39d042f19a7052f8b0ee093e8b6194d6"
{"total_rows":8,"offset":3,"rows":[
{"id":"39d042f19a7052f8b0ee093e8b6194d6","key":1,"value":null},
{"id":"39d042f19a7052f8b0ee093e8b61af73","key":1,"value":null}
]}
fenollp commented 7 years ago

Hello there @benoitc :) News on this?

serg-i-o commented 6 years ago

Hi @benoitc ! May be we add support for both start_docid (end_docid) and startkey_docid (endtkey_docid)? I can quickly add fix based on this request. Without this fix i can't fix pagination in kazoo project.