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

View result doesn't have 'offset' field

1 reply [Last post]
  • Login or register to post comments
Wed, 09/05/2012 - 20:05
Koji Kawamura
Offline
Joined: 02/02/2012
Groups: None

Hi,

I'm using Couchbase Server 2.0 DP4.
When I request to a View or _all_docs, the result JSON doesn't contain 'offset' field in it.
With only 'total_rows' field, how do I know how many rows are there when I use 'startkey' and 'limit' parameters?

CouchDB returns 'offset' value so that I can figure out how many rows exist in such case like below:

# With CouchDB
GET http://localhost:5984/database/_all_docs?startkey=%22foo%22&limit=1
{"total_rows":32554,"offset":32551,"rows":[ {id: ...} ]}
means, there are 3 rows after the 'startkey'.

# With Couchbase
GET http://localhost:8092/database/_all_docs?startkey=%22foo%22&limit=1
{"total_rows":32554,"rows":[ {id: ...} ]}
I can't figure out how many rows are there..

Is it an expected behavior and design?

Thanks in advance,
Koji Kawamura

Top
  • Login or register to post comments
Thu, 09/06/2012 - 03:08
schom
Offline
Joined: 07/02/2012
Groups: None

Hi,

I'm interested in something similar. Given a query ?key=12345 I would like the offset of this key, basically to know what position it is in the list. In all the documentation I have read, I have not found a way to do this.

What we want to use it for is a toplist in a game, and given a players score we want the rank on a global toplist (a view in couchbase). Is it possible to do in the current version? Will it be possible to do in an upcoming version?

A worst we have to implement our own binary search with ?offset=n, but that seems like a terrible way to do it.

Cheers,
David

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