couchdb - Strange error message -
i have defined following view:
{ "_id":"_design/test", "language":"javascript", "views": { "test": { "map": "function(doc) { (var k in doc.data) emit(doc.data[k],null);}", "options": {"collation":"raw"} } } }
when querying view without parameters, expected result (sorted "ab...ab" instead of "aabb" because specified raw collation):
http://localhost:5985/test/_design/test/_view/test {"total_rows":13,"offset":0,"rows":[ {"id":"-","key":"a","value":null}, {"id":"-","key":"b","value":null}, {"id":"-","key":"c","value":null}, {"id":"-","key":"d","value":null}, {"id":"-","key":"e","value":null}, {"id":"-","key":"f","value":null}, {"id":"-","key":"a","value":null}, {"id":"-","key":"b","value":null}, {"id":"-","key":"c","value":null}, {"id":"-","key":"d","value":null}, {"id":"-","key":"e","value":null}, {"id":"-","key":"f","value":null}, {"id":"-","key":"g","value":null} ]}
i use startkey
, endkey
ask range between b
, a
, , expect receive keys bcdefa
, instead receive following error message:
http://localhost:5985/test/_design/test/_view/test?startkey=%22b%22&endkey=%22a%22 { "error": "query_parse_error", "reason": "no rows can match key range, reverse start_key , end_key or set descending=true" }
why no rows can match key range, when rows b,c,d,e,f , match ?
edit: have single document (revision , id omitted):
{ "_id": "-", "_rev": "-", "data": [ "a", "b", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f", "g" ] }
i can confirm experience same behaviour in version 1.1 on ubuntu 10.04.
to elaborate:
curl http://localhost:5984/test/_design/test/_view/view?startkey=%22b%22\&endkey=%22a%22
returns error
{"error":"query_parse_error","reason":"no rows can match key range, reverse start_key , end_key or set descending=true"}
while
curl http://localhost:5984/test/_design/test/_view/view?startkey=%22b%22\&endkey=%22d%22
gives
{"total_rows":12,"offset":1,"rows":[
{"id":"stuff","key":"b","value":null}, {"id":"stuff","key":"c","value":null}, {"id":"stuff","key":"d","value":null} ]}
so quoting issues don't problem.
i using single document:
{
"_id": "stuff", "_rev": "2-0507028fcab427a1b28ed6b3d4a6c05e", "data": [ "a", "b", "c", "d", "e", "f", "a", "b", "c", "d", "e", "f" ] }
Comments
Post a Comment