I defined the following view:
{ "_id":"_design/test",
"language":"javascript",
"views":
{ "test":
{ "map": "function(doc) { for (var k in doc.data) emit(doc.data[k],null);}",
"options": {"collation":"raw"}
}
}
}
When requesting a view without any parameters, I get the expected result (sorted as "AB ... ab" instead of "aAbB" because I specified a raw sort):
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}
]}
Then I use startkeyboth endkeyto query the range between Band a, and I expect to get the keys BCDEFa, but instead I get the 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 your key range, reverse your start_key and
end_key or set descending=true"
}
Why does he say that no lines can match a range of keys when lines B, C, D, E, F and a match?
EDIT: I have one document (revision and id omitted):
{ "_id": "-",
"_rev": "-",
"data": [ "A", "B", "C", "D", "E", "F", "a", "b", "c", "d", "e", "f", "g" ]
}