Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

Is this a strange view query?

3 replies [Last post]
  • Login or register to post comments
Fri, 01/18/2013 - 02:48
biswajit
Offline
Joined: 03/28/2012
Groups: None

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

Top
  • Login or register to post comments
Tue, 01/22/2013 - 10:05
tgrall
Offline
Joined: 09/05/2012
Groups: None

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

Top
  • Login or register to post comments
Tue, 01/22/2013 - 23:51
biswajit
Offline
Joined: 03/28/2012
Groups: None

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?

Top
  • Login or register to post comments
Wed, 01/23/2013 - 00:55
tgrall
Offline
Joined: 09/05/2012
Groups: None

Biswajit

You just need to do something like:

yourview?startkey="[2011]"&endkey="[2011,0]"&descending=true

Tug

__________________

Tug
@tgrall

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker