You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by John <jo...@netdev.co.uk> on 2010/11/30 23:09:59 UTC

Example curl command for multi part index required

Hi

Would somebody please show me how to make a curl command on a three part index (all strings) where the first and second part could be anything but the third is known.
i.e. [*, *, "myid"].

I thought I could use 0 to {} for the first two indices but that didn't seem to work but perhaps I'm not escaping properly OR is it not possible to do the search with the indexes in this order?

Regards

John


Re: Example curl command for multi part index required

Posted by Paul Davis <pa...@gmail.com>.
> in the usual trick of startkey=["foo"]&endkey=["foo",{}], {} is not a
> wildcard, it's an empty object. The trick works because an object, any
> object, sorts higher than any number or string.
>
> To call that a wildcard is wildly misleading. badoom tssh.

Touché

Re: Example curl command for multi part index required

Posted by John <jo...@netdev.co.uk>.
Thanks Bob and Paul.

It's obvious when someone talks slowly and spells it out for you......

The mental picture of an array in an array in an array works for me!

If I could just get use to this whole "disk is cheap" think then I wouldn't try to be so *clever* with my views and just get on with making the ones I need......

Cheers

John

On 30 Nov 2010, at 22:16, Robert Newson wrote:

> You can't even wild card the last element.
> 
> in the usual trick of startkey=["foo"]&endkey=["foo",{}], {} is not a
> wildcard, it's an empty object. The trick works because an object, any
> object, sorts higher than any number or string.
> 
> To call that a wildcard is wildly misleading. badoom tssh.
> 
> B.
> 
> On Tue, Nov 30, 2010 at 10:13 PM, Paul Davis
> <pa...@gmail.com> wrote:
>> On Tue, Nov 30, 2010 at 5:09 PM, John <jo...@netdev.co.uk> wrote:
>>> Hi
>>> 
>>> Would somebody please show me how to make a curl command on a three part index (all strings) where the first and second part could be anything but the third is known.
>>> i.e. [*, *, "myid"].
>>> 
>>> I thought I could use 0 to {} for the first two indices but that didn't seem to work but perhaps I'm not escaping properly OR is it not possible to do the search with the indexes in this order?
>>> 
>>> Regards
>>> 
>>> John
>>> 
>>> 
>> 
>> You can only wild card the last element of the array key. Wild carding
>> the first element is roughly equivalent to asking for array semantics.
>> 
>> The easiest way to think of it is as if the view is a larger array. A
>> view request is just asking for a single contiguous slice of that
>> array. The various parameters are just specifying where you start and
>> stop.
>> 
>> HTH,
>> Paul Davis
>> 


Re: Example curl command for multi part index required

Posted by Robert Newson <ro...@gmail.com>.
You can't even wild card the last element.

in the usual trick of startkey=["foo"]&endkey=["foo",{}], {} is not a
wildcard, it's an empty object. The trick works because an object, any
object, sorts higher than any number or string.

To call that a wildcard is wildly misleading. badoom tssh.

B.

On Tue, Nov 30, 2010 at 10:13 PM, Paul Davis
<pa...@gmail.com> wrote:
> On Tue, Nov 30, 2010 at 5:09 PM, John <jo...@netdev.co.uk> wrote:
>> Hi
>>
>> Would somebody please show me how to make a curl command on a three part index (all strings) where the first and second part could be anything but the third is known.
>> i.e. [*, *, "myid"].
>>
>> I thought I could use 0 to {} for the first two indices but that didn't seem to work but perhaps I'm not escaping properly OR is it not possible to do the search with the indexes in this order?
>>
>> Regards
>>
>> John
>>
>>
>
> You can only wild card the last element of the array key. Wild carding
> the first element is roughly equivalent to asking for array semantics.
>
> The easiest way to think of it is as if the view is a larger array. A
> view request is just asking for a single contiguous slice of that
> array. The various parameters are just specifying where you start and
> stop.
>
> HTH,
> Paul Davis
>

Re: Example curl command for multi part index required

Posted by Paul Davis <pa...@gmail.com>.
On Tue, Nov 30, 2010 at 5:09 PM, John <jo...@netdev.co.uk> wrote:
> Hi
>
> Would somebody please show me how to make a curl command on a three part index (all strings) where the first and second part could be anything but the third is known.
> i.e. [*, *, "myid"].
>
> I thought I could use 0 to {} for the first two indices but that didn't seem to work but perhaps I'm not escaping properly OR is it not possible to do the search with the indexes in this order?
>
> Regards
>
> John
>
>

You can only wild card the last element of the array key. Wild carding
the first element is roughly equivalent to asking for array semantics.

The easiest way to think of it is as if the view is a larger array. A
view request is just asking for a single contiguous slice of that
array. The various parameters are just specifying where you start and
stop.

HTH,
Paul Davis

Re: Example curl command for multi part index required

Posted by Robert Newson <ro...@gmail.com>.
"is it not possible to do the search with the indexes in this order?"

Bingo.

There are no wildcards available in views. A lookup can be made to a
specific key, or a range lookup can be made between two keys, but all
entries in the view are in key order.

You can do this;

?startkey=["foo"]&endkey=["foo",{}] to find keys like ["foo", 1] and
["foo", "hello"]

but you cannot do this;

?startkey[*, "foo"]&endkey[*, "bar"]

B.

On Tue, Nov 30, 2010 at 10:09 PM, John <jo...@netdev.co.uk> wrote:
> Hi
>
> Would somebody please show me how to make a curl command on a three part index (all strings) where the first and second part could be anything but the third is known.
> i.e. [*, *, "myid"].
>
> I thought I could use 0 to {} for the first two indices but that didn't seem to work but perhaps I'm not escaping properly OR is it not possible to do the search with the indexes in this order?
>
> Regards
>
> John
>
>