You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Andrey Cherkashin <an...@gmail.com> on 2011/09/01 03:53:26 UTC

Re: startkey and endkey

Any ideas?
On Aug 30, 2011, at 3:48 AM, Robert Newson wrote:

> Try ?startkey=["Paint"]&endkey=["Paint",{}]
> 
> B.
> 
> On 30 August 2011 08:52, Ganzha Alexey <tr...@gmail.com> wrote:
>> It looks like it will enough startkey=["Paint"]&endkey=["Paintz"]
>> than for subcategory: ["Paint","Inside"]&endkey=["Paintz","Insidez"]
>> or use '\u221e' instead of 'z'
>> 
>> On Tue, Aug 30, 2011 at 10:04 AM, Andrey Cherkashin <an...@gmail.com>wrote:
>> 
>>> startkey=["Paint", " ", " ", 0]
>>> endkey=["Paint", {}, {}, 0]
>>> 
>>> nothing. Btw, i'm trying to get all docs in one specific category, then in
>>> category and sub-category.
>>> On Aug 29, 2011, at 11:58 PM, Ganzha Alexey wrote:
>>> 
>>>> Make Elements in startkey array the same type as keys emited.
>>>> [string,string,string,int]
>>>> 
>>>> On Tue, Aug 30, 2011 at 9:49 AM, Andrey Cherkashin <andoriyu@gmail.com
>>>> wrote:
>>>> 
>>>>> ["Paint", "Inside", "01-05.01-0002", 0]
>>>>> ["Paint", "Inside", "01-05.01-0003", 0]
>>>>> ["Paint", "Outside", "01-05.01-0004", 0]
>>>>> 
>>>>> 
>>>>> On Aug 29, 2011, at 11:35 PM, Ganzha Alexey wrote:
>>>>> 
>>>>>> More details required.
>>>>>> Drop here some rows from your view.
>>>>>> 
>>>>>> On Tue, Aug 30, 2011 at 9:29 AM, Andrey Cherkashin <andoriyu@gmail.com
>>>>>> wrote:
>>>>>> 
>>>>>>> When I do exact match in start key and end key, i got 0 results.
>>>>>>> On Aug 29, 2011, at 11:26 PM, Ganzha Alexey wrote:
>>>>>>> 
>>>>>>>> Hello.
>>>>>>>> Your start key must match exactly some key in database.
>>>>>>>> It is like an anchor. After db hits your start key, it begn emit for
>>>>> you
>>>>>>> all
>>>>>>>> rows with the key which is less than startkey according to view
>>>>>>> collation.
>>>>>>>> 
>>>>>>>> On Tue, Aug 30, 2011 at 8:33 AM, Andrey Cherkashin <
>>> andoriyu@gmail.com
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> Hello everyone.
>>>>>>>>> 
>>>>>>>>> I have a problem with using couch views that has "complex" keys
>>> like:
>>>>>>>>> ["Category", "sub-cat", "sku", 100]
>>>>>>>>> 
>>>>>>>>> For example, I trying to get all docs that is in "Paint" category,
>>> so
>>>>> my
>>>>>>>>> first guess was:
>>>>>>>>> startkey=["Paint",0,0,0]&endkey=["Paint",{},{},{}]
>>>>>>>>> but i got nothing. What am i doing wrong?
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>> 
>>> 
>> 


Re: startkey and endkey

Posted by Andrey Cherkashin <an...@gmail.com>.
But at the same  time it isn't working in Couchrest::model :
>> Item.filter.startkey('["io"]').endkey('["ioz",{}]').to_a
[]
On Sep 1, 2011, at 3:11 AM, Fábio Batalha wrote:

> 
>>> Try ?startkey=["Paint"]&endkey=["Paintz",{}]
> 
> Sent from my iPhone
> 
> On 31/08/2011, at 22:53, Andrey Cherkashin <an...@gmail.com> wrote:
> 
>> Any ideas?
>> On Aug 30, 2011, at 3:48 AM, Robert Newson wrote:
>> 
>>> Try ?startkey=["Paint"]&endkey=["Paint",{}]
>>> 
>>> B.
>>> 
>>> On 30 August 2011 08:52, Ganzha Alexey <tr...@gmail.com> wrote:
>>>> It looks like it will enough startkey=["Paint"]&endkey=["Paintz"]
>>>> than for subcategory: ["Paint","Inside"]&endkey=["Paintz","Insidez"]
>>>> or use '\u221e' instead of 'z'
>>>> 
>>>> On Tue, Aug 30, 2011 at 10:04 AM, Andrey Cherkashin <an...@gmail.com>wrote:
>>>> 
>>>>> startkey=["Paint", " ", " ", 0]
>>>>> endkey=["Paint", {}, {}, 0]
>>>>> 
>>>>> nothing. Btw, i'm trying to get all docs in one specific category, then in
>>>>> category and sub-category.
>>>>> On Aug 29, 2011, at 11:58 PM, Ganzha Alexey wrote:
>>>>> 
>>>>>> Make Elements in startkey array the same type as keys emited.
>>>>>> [string,string,string,int]
>>>>>> 
>>>>>> On Tue, Aug 30, 2011 at 9:49 AM, Andrey Cherkashin <andoriyu@gmail.com
>>>>>> wrote:
>>>>>> 
>>>>>>> ["Paint", "Inside", "01-05.01-0002", 0]
>>>>>>> ["Paint", "Inside", "01-05.01-0003", 0]
>>>>>>> ["Paint", "Outside", "01-05.01-0004", 0]
>>>>>>> 
>>>>>>> 
>>>>>>> On Aug 29, 2011, at 11:35 PM, Ganzha Alexey wrote:
>>>>>>> 
>>>>>>>> More details required.
>>>>>>>> Drop here some rows from your view.
>>>>>>>> 
>>>>>>>> On Tue, Aug 30, 2011 at 9:29 AM, Andrey Cherkashin <andoriyu@gmail.com
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> When I do exact match in start key and end key, i got 0 results.
>>>>>>>>> On Aug 29, 2011, at 11:26 PM, Ganzha Alexey wrote:
>>>>>>>>> 
>>>>>>>>>> Hello.
>>>>>>>>>> Your start key must match exactly some key in database.
>>>>>>>>>> It is like an anchor. After db hits your start key, it begn emit for
>>>>>>> you
>>>>>>>>> all
>>>>>>>>>> rows with the key which is less than startkey according to view
>>>>>>>>> collation.
>>>>>>>>>> 
>>>>>>>>>> On Tue, Aug 30, 2011 at 8:33 AM, Andrey Cherkashin <
>>>>> andoriyu@gmail.com
>>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Hello everyone.
>>>>>>>>>>> 
>>>>>>>>>>> I have a problem with using couch views that has "complex" keys
>>>>> like:
>>>>>>>>>>> ["Category", "sub-cat", "sku", 100]
>>>>>>>>>>> 
>>>>>>>>>>> For example, I trying to get all docs that is in "Paint" category,
>>>>> so
>>>>>>> my
>>>>>>>>>>> first guess was:
>>>>>>>>>>> startkey=["Paint",0,0,0]&endkey=["Paint",{},{},{}]
>>>>>>>>>>> but i got nothing. What am i doing wrong?
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>> 
>> 


Re: startkey and endkey

Posted by Andrey Cherkashin <an...@gmail.com>.
It works, but only for keys in english, for example it will return nothing if i query "Краски".

curl https://couch.dev/project_ngein-sac_dev/_design//Item/_view/filter :

{"id":"Item--10-01.02-1211--624525","key":["\u0414\u0440\u0443\u0433\u043e\u0435","\u0414\u0440\u0443\u0433\u043e\u0435","10-01.02-1211",0],"value":null},
{"id":"Item--10-01.01-1111--919678","key":["\u041a\u0440\u0430\u0441\u043a\u0438","\u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b","10-01.01-1111",0],"value":null},



On Sep 1, 2011, at 3:11 AM, Fábio Batalha wrote:

> 
>>> Try ?startkey=["Paint"]&endkey=["Paintz",{}]
> 
> Sent from my iPhone
> 
> On 31/08/2011, at 22:53, Andrey Cherkashin <an...@gmail.com> wrote:
> 
>> Any ideas?
>> On Aug 30, 2011, at 3:48 AM, Robert Newson wrote:
>> 
>>> Try ?startkey=["Paint"]&endkey=["Paint",{}]
>>> 
>>> B.
>>> 
>>> On 30 August 2011 08:52, Ganzha Alexey <tr...@gmail.com> wrote:
>>>> It looks like it will enough startkey=["Paint"]&endkey=["Paintz"]
>>>> than for subcategory: ["Paint","Inside"]&endkey=["Paintz","Insidez"]
>>>> or use '\u221e' instead of 'z'
>>>> 
>>>> On Tue, Aug 30, 2011 at 10:04 AM, Andrey Cherkashin <an...@gmail.com>wrote:
>>>> 
>>>>> startkey=["Paint", " ", " ", 0]
>>>>> endkey=["Paint", {}, {}, 0]
>>>>> 
>>>>> nothing. Btw, i'm trying to get all docs in one specific category, then in
>>>>> category and sub-category.
>>>>> On Aug 29, 2011, at 11:58 PM, Ganzha Alexey wrote:
>>>>> 
>>>>>> Make Elements in startkey array the same type as keys emited.
>>>>>> [string,string,string,int]
>>>>>> 
>>>>>> On Tue, Aug 30, 2011 at 9:49 AM, Andrey Cherkashin <andoriyu@gmail.com
>>>>>> wrote:
>>>>>> 
>>>>>>> ["Paint", "Inside", "01-05.01-0002", 0]
>>>>>>> ["Paint", "Inside", "01-05.01-0003", 0]
>>>>>>> ["Paint", "Outside", "01-05.01-0004", 0]
>>>>>>> 
>>>>>>> 
>>>>>>> On Aug 29, 2011, at 11:35 PM, Ganzha Alexey wrote:
>>>>>>> 
>>>>>>>> More details required.
>>>>>>>> Drop here some rows from your view.
>>>>>>>> 
>>>>>>>> On Tue, Aug 30, 2011 at 9:29 AM, Andrey Cherkashin <andoriyu@gmail.com
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> When I do exact match in start key and end key, i got 0 results.
>>>>>>>>> On Aug 29, 2011, at 11:26 PM, Ganzha Alexey wrote:
>>>>>>>>> 
>>>>>>>>>> Hello.
>>>>>>>>>> Your start key must match exactly some key in database.
>>>>>>>>>> It is like an anchor. After db hits your start key, it begn emit for
>>>>>>> you
>>>>>>>>> all
>>>>>>>>>> rows with the key which is less than startkey according to view
>>>>>>>>> collation.
>>>>>>>>>> 
>>>>>>>>>> On Tue, Aug 30, 2011 at 8:33 AM, Andrey Cherkashin <
>>>>> andoriyu@gmail.com
>>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Hello everyone.
>>>>>>>>>>> 
>>>>>>>>>>> I have a problem with using couch views that has "complex" keys
>>>>> like:
>>>>>>>>>>> ["Category", "sub-cat", "sku", 100]
>>>>>>>>>>> 
>>>>>>>>>>> For example, I trying to get all docs that is in "Paint" category,
>>>>> so
>>>>>>> my
>>>>>>>>>>> first guess was:
>>>>>>>>>>> startkey=["Paint",0,0,0]&endkey=["Paint",{},{},{}]
>>>>>>>>>>> but i got nothing. What am i doing wrong?
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>> 
>> 


Re: startkey and endkey

Posted by Fábio Batalha <fa...@gmail.com>.
>> Try ?startkey=["Paint"]&endkey=["Paintz",{}]

Sent from my iPhone

On 31/08/2011, at 22:53, Andrey Cherkashin <an...@gmail.com> wrote:

> Any ideas?
> On Aug 30, 2011, at 3:48 AM, Robert Newson wrote:
> 
>> Try ?startkey=["Paint"]&endkey=["Paint",{}]
>> 
>> B.
>> 
>> On 30 August 2011 08:52, Ganzha Alexey <tr...@gmail.com> wrote:
>>> It looks like it will enough startkey=["Paint"]&endkey=["Paintz"]
>>> than for subcategory: ["Paint","Inside"]&endkey=["Paintz","Insidez"]
>>> or use '\u221e' instead of 'z'
>>> 
>>> On Tue, Aug 30, 2011 at 10:04 AM, Andrey Cherkashin <an...@gmail.com>wrote:
>>> 
>>>> startkey=["Paint", " ", " ", 0]
>>>> endkey=["Paint", {}, {}, 0]
>>>> 
>>>> nothing. Btw, i'm trying to get all docs in one specific category, then in
>>>> category and sub-category.
>>>> On Aug 29, 2011, at 11:58 PM, Ganzha Alexey wrote:
>>>> 
>>>>> Make Elements in startkey array the same type as keys emited.
>>>>> [string,string,string,int]
>>>>> 
>>>>> On Tue, Aug 30, 2011 at 9:49 AM, Andrey Cherkashin <andoriyu@gmail.com
>>>>> wrote:
>>>>> 
>>>>>> ["Paint", "Inside", "01-05.01-0002", 0]
>>>>>> ["Paint", "Inside", "01-05.01-0003", 0]
>>>>>> ["Paint", "Outside", "01-05.01-0004", 0]
>>>>>> 
>>>>>> 
>>>>>> On Aug 29, 2011, at 11:35 PM, Ganzha Alexey wrote:
>>>>>> 
>>>>>>> More details required.
>>>>>>> Drop here some rows from your view.
>>>>>>> 
>>>>>>> On Tue, Aug 30, 2011 at 9:29 AM, Andrey Cherkashin <andoriyu@gmail.com
>>>>>>> wrote:
>>>>>>> 
>>>>>>>> When I do exact match in start key and end key, i got 0 results.
>>>>>>>> On Aug 29, 2011, at 11:26 PM, Ganzha Alexey wrote:
>>>>>>>> 
>>>>>>>>> Hello.
>>>>>>>>> Your start key must match exactly some key in database.
>>>>>>>>> It is like an anchor. After db hits your start key, it begn emit for
>>>>>> you
>>>>>>>> all
>>>>>>>>> rows with the key which is less than startkey according to view
>>>>>>>> collation.
>>>>>>>>> 
>>>>>>>>> On Tue, Aug 30, 2011 at 8:33 AM, Andrey Cherkashin <
>>>> andoriyu@gmail.com
>>>>>>>>> wrote:
>>>>>>>>> 
>>>>>>>>>> Hello everyone.
>>>>>>>>>> 
>>>>>>>>>> I have a problem with using couch views that has "complex" keys
>>>> like:
>>>>>>>>>> ["Category", "sub-cat", "sku", 100]
>>>>>>>>>> 
>>>>>>>>>> For example, I trying to get all docs that is in "Paint" category,
>>>> so
>>>>>> my
>>>>>>>>>> first guess was:
>>>>>>>>>> startkey=["Paint",0,0,0]&endkey=["Paint",{},{},{}]
>>>>>>>>>> but i got nothing. What am i doing wrong?
>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>> 
>