Closed beadsland closed 3 years ago
Hi @beadsland ,
Thank you for this bug report. Can you please provide a more complete steps to reproduce? I'm asking, because the following works for me:
from cloudant.client import CouchDB
client = CouchDB("admin", "password", url='http://127.0.0.1:5984', connect=True)
session = client.session()
db = client['testing']
for item in db.get_view_result("newDD", "new-view", group=True):
print(item)
client.disconnect()
where
curl http://admin:password@127.0.0.1:5984/testing/_all_docs?include_docs=true |jq
{
"total_rows": 2,
"offset": 0,
"rows": [
{
"id": "_design/newDD",
"key": "_design/newDD",
"value": {
"rev": "2-0611118a25d6d8435680e48fdefe1f37"
},
"doc": {
"_id": "_design/newDD",
"_rev": "2-0611118a25d6d8435680e48fdefe1f37",
"views": {
"new-view": {
"map": "function (doc) {\n emit(doc._id, 1);\n}",
"reduce": "_count"
}
},
"language": "javascript"
}
},
{
"id": "f4e47445a7324cb60c32f5d41e00077a",
"key": "f4e47445a7324cb60c32f5d41e00077a",
"value": {
"rev": "1-4c6114c65e295552ab1019e2b046b10e"
},
"doc": {
"_id": "f4e47445a7324cb60c32f5d41e00077a",
"_rev": "1-4c6114c65e295552ab1019e2b046b10e",
"foo": "bar"
}
}
]
}
This issue can be reproduced when the amount of documents is greater than the page size. Example using the code block above:
...
for item in db.get_view_result("views101", "diet_count", group=True, page_size=1):
print(item)
I'll open a PR to check that the id
exists on line 400 in cloudant/result.py
.
Bug Description
1. Steps to reproduce and the simplest code sample possible to demonstrate the issue
2. What you expected to happen
Iterate over all grouped reductions.
3. What actually happened
Iterate over grouped reductions, followed by:
Environment details
4. Simple fix
Change the offending line to: