This is a common misconception that contains the key index of a compound array, it is still considered a string, so the index key [2,10] is actually "[2,10]" and the index key [5,20] is actually " [5.20]. "
Thus, the reason why startkey=["2", "30"] shows the line {"id":"5","key":["5","20"],"value":null}, , is that as a string this is> startkey.
Similarly, the query startkey=[2,10]&endkey=[5,10] returns
{"total_rows":7,"rows":[ {"id":"2","key":[2,20],"value":null}, {"id":"3","key":[3,30],"value":null}, {"id":"4","key":[4,30],"value":null} ] }
because startkey="[2,10]" < "[2,20]" && "[4,30]" "[5,10]"=endkey , but "[5,20]" is not within this range of rows.
Range Queries with Start Key and End Key
startkey => endkey is a range query using strcmp (), the group and group level is based on the line where the comma separates the character characters.
Good Link Link (since Couchbase Views works just like Apache CouchDB Views (inspired by them)) http://wiki.apache.org/couchdb/View_collation#Collation_Specification
Spatial View / Query
To achieve the result you are trying to do, you can also write a spatial view to have multidimensional queries, only numerical. Although you cannot initially think about it
function (doc, meta) { emit({ type: "Point", coordinates: [doc.ID, doc.Price] }, meta.id); }
The request will be a bounding block request:
& BBOX = 2,0,8,30
{"total_rows":0,"rows":[ {"id":"2","bbox":[2,20,2,20],"geometry":{"type":"Point","coordinates":[2,20]},"value":"2"}, {"id":"3","bbox":[3,30,3,30],"geometry":{"type":"Point","coordinates":[3,30]},"value":"3"}, {"id":"4","bbox":[4,30,4,30],"geometry":{"type":"Point","coordinates":[4,30]},"value":"4"}, {"id":"5","bbox":[5,20,5,20],"geometry":{"type":"Point","coordinates":[5,20]},"value":"5"} ] }
Another request:
& BBOX = 2.30.8.30
{"total_rows":0,"rows":[ {"id":"3","bbox":[3,30,3,30],"geometry":{"type":"Point","coordinates":[3,30]},"value":"3"}, {"id":"4","bbox":[4,30,4,30],"geometry":{"type":"Point","coordinates":[4,30]},"value":"4"} ] }