cloudant / python-cloudant

A Python library for Cloudant and CouchDB
Apache License 2.0
163 stars 55 forks source link

Fix result paging for grouped view queries #487

Closed emlaver closed 3 years ago

emlaver commented 3 years ago

Checklist

Description

When querying a grouped view where either a) there's more documents than the default page size or b) there's more documents that the user-defined page size option, a KeyError occurs. This happens when the view data iteration logic tries to retrieve the next set of results.

When querying a grouped view where pagination is needed, a KeyError occurs when trying to grab the next page. This error is happening because the iteration logic is expecting an id field which does not exist for grouped view results.

fixes #456

Approach

Update line 400 in cloudant/result.py to check that the id field exists.

Schema & API Changes

Security and Privacy

Testing

Added new test DatabaseTests.test_retrieve_grouped_view_result_with_page_size.

Monitoring and Logging