View result doesn't have 'offset' field
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
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