Strange error message

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" ] 
}
+5
source share
3 answers

, , , . JIRA- . , .

0

, 1.1 Ubuntu 10.04.

:

curl http://localhost:5984/test/_design/test/_view/view?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"}

while

curl http://localhost:5984/test/_design/test/_view/view?startkey=%22B%22\&endkey=%22D%22

{"total_rows":12,"offset":1,"rows":[

{ "ID" : "" "": ​​ "B", "" : }, { "ID" : "" , "" : "C", "" : }, { "ID" : "" , "" : "D", "" : NULL} ]}

, .

:

{

"_ id": "" ,   "_rev": "2-0507028fcab427a1b28ed6b3d4a6c05e",   "": [       "",       "",       "",       "D",       "E",       "F",       "",       "",       "",       "",       "",       ""  ] }

+2

http://guide.couchdb.org/draft/views.html ( " " ). , .

, descending=true. startkey, , CouchDB . ?

, , . . , , CouchDB:

, startkey , .

endkey, .

descending=true, , . , .

, , :

KeyValue 0 "foo" 1 "bar" 2 "baz"

: ?startkey=1&descending=true. CouchDB? . № 1 : startkey, 1, , . , :

KeyValue 1 "bar" 0 "foo"

, , , . 1 2 , startkey endkey: endkey=1&descending=true:

KeyValue 2 "baz" 1 "bar"

. CouchDB , endkey.

+1

All Articles