taking the following data in your view with these keys:
startkey == [a, 11] and endkey == [c, 11] :
[a, 10] [a, 11] <-- startkey [a, 12] <-- [b, 10] <-- [b, 11] <-- [b, 12] <-- [c, 10] <-- [c, 11] <-- endkey [c, 12]
(All marked with an arrow will be returned).
Data in the view is sorted using the key. With startkey and endkey you can control where to start and end the presentation. You cannot specify data limits. Anything sorted between startkey and endkey will be returned. Please read http://wiki.apache.org/couchdb/View_collation for more information.
If you want to perform geospatial queries, you should check out GeoCouch ( https://github.com/couchbase/geocouch/ ).
Summed up: Keys in CouchDB views are stored in one-dimensional lists. Entries in these lists are sorted according to the rules in View_collation . Two-dimensional arrays may look special, but in reality this is not so. [a, 10] sorted after [a] and after a and before [b, 5] and before [c] (for example).
If you use startkey and endkey , you say "everything, including after startkey , and before and after endkey ". The startkey and endkey do not have to be in the list.
thriqon
source share