couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Newson (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1498) range_prefix view parameter to ease working with ranges
Date Mon, 18 Jun 2012 15:49:43 GMT


Robert Newson commented on COUCHDB-1498:

Those are the kinds of thing I thought you meant and, for me, they fail my point 1 in that
the values chosen for startkey/endkey will depend on the types of the supplied range_prefix
value. This is surprising and potentially very confusing.

I'll note, since you raised them, that none of the startkey/endkey examples are quite right.

Futon find design documents using startkey="_design/"&endkey="_design0" since design documents,
by definition, occupy a namespace delimited by / and 0 is the next character up from there.

The assumption that empty object is the intended endkey in your second example is questionable
and the assumption that Z is the last letter of the alphabet is false.

I'd like to hear from other developers but I don't in general see a solid heuristic for guessing
correct startkey and endkey values from a prefix value. While it seems intuitive in the cases
Ronny mentions, the devil, as always, is in the details.

To end on a more positive note, I would suggest this as the least surprising, but still useful


This will *only* work for array keys and will not guess partially completed items. The above
query will find ["foo"], ["foo", 12], ["foo", {"foo":"bar"}], ["foo", bar"], etc (but not
["goo"], or ["food"]).

> range_prefix view parameter to ease working with ranges
> -------------------------------------------------------
>                 Key: COUCHDB-1498
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>          Components: View Server Support
>            Reporter: Ronny Pfannschmidt
> queries for certain ranges are a common operation,
> but we are usually left with figuring what kind of start/end key combination to use if
we want a certain range
> it would be really pleasant if instead of constructing a start/end range from a prefix
by guessing mostly how to construct the end param,
> we could just pass the range prefix as a string/array to the view

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message