Is this a strange view query?
Hi,
I have a map which outs the key and value as follows
["a",2012,12,6,6,43,50] ["a",2012,12,6,6,44,44] ["a",2012,12,6,6,44,45] ["a",2012,12,6,6,45,20] ["a",2012,12,6,6,45,24] ["b",2012,12,6,6,45,26] ["b",2012,12,6,6,47,10] ["b",2012,12,6,6,47,14] ["b",2012,12,6,6,47,16] ["b",2012,12,6,7,37,57]
So when when My query has startkey = ["b"] It returns me all the b values....But when I Do with descending true, nothing returns....Am I missing Anything here?
Regards
Biswajit
Hummmm....Now that will make developing application tricky, don't you think?
Lets say a map output as
[2010,1]
[2010,3]
[2010,5]
[2011,1]
[2011,2]
[2011,3]
[2011,7]
[2011,8]
[2011,9]
[2012,1]
[2012,2]
[2012,3]
[2012,4]
[2013,1]
So in this order I can easily get what happened with year 2011, but when descendant I must have to know what was the next year after 2011 (Silly isn't it?) then what about 2013? :( I have make a Imaginary year 2014? :D
Anything missing here?
Biswajit
You just need to do something like:
yourview?startkey="[2011]"&endkey="[2011,0]"&descending=true
Tug
Hello,
This is "expected" by the way the index is traverse when doing a range query.
I invite you to read this blog article from Jasdeep (@scalabl3) on Keys and views:
http://blog.couchbase.com/understanding-letter-ordering-view-queries
and the ordering with range is explained here:
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writi...
Note that you can use the parameter "inclusive_end" to be sure that you include the endkey to your result.
Regards
Tug
@tgrall