incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Snider <j...@jsnider.net>
Subject Re: View Collation
Date Wed, 17 Jul 2013 19:02:14 GMT
You are checking doc.marker in your if statement.  0 in JS is false, so nothing is emitted
for the doc when marker is 0.  Try 'marker' in doc instead if you're going to have falsy values
in there.





On Jul 17, 2013, at 1:41 PM, Stephan Bardubitzki wrote:

> I see, thanks.
> 
> Still, the doc with doc.marker: 0 is omitted.
> 
> 
> On 13-07-17 11:34 AM, Robert Newson wrote:
>> Sure, but shorter arrays sort earlier than longer ones, so ["fr", id]
>> sorts before any 3-item array, and thus before ["fr",id,0]. :)
>> 
>> On 17 July 2013 19:32, Stephan Bardubitzki <stephan@bardubitzki.com> wrote:
>>> The third element in the startkey is the number property to be sorted. Here
>>> is my map function:
>>> 
>>> function(doc) {
>>>     if (doc.kml_id && doc.marker && doc.language) {
>>>         for (language in doc['language']) {
>>>             var o = {};
>>>             o.description = doc.language[language];
>>>             o.gps = doc.gps;
>>>             emit([language, doc.kml_id, doc.marker], o);
>>> 
>>>         }
>>>     }
>>> }
>>> 
>>> On 13-07-17 11:21 AM, Robert Newson wrote:
>>>> Use start key of ["fr",id]
>>>> On 17 Jul 2013 19:18, "Stephan Bardubitzki" <stephan@bardubitzki.com>
>>>> wrote:
>>>> 
>>>>> In my docs I have a Number property starting at 0. My start/end key looks
>>>>> like this:
>>>>> 
>>>>> startkey: ["fr", id, 0]. endkey: ["fr", id, {}]
>>>>> 
>>>>> to sort the response by this property. It seems to work well, however,
>>>>> the
>>>>> doc with the property value=0 is omitted.
>>>>> 
>>>>> I presume the view collation for numbers is starting at 1?
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> --------------------------------
>>>> Spam/Virus scanning by CanIt Pro
>>>> 
>>>> For more information see
>>>> http://www.kgbinternet.com/SpamFilter.htm
>>>> 
>>>> To control your spam filter, log in at
>>>> http://filter.kgbinternet.com
>>>> 
>> --------------------------------
>> Spam/Virus scanning by CanIt Pro
>> 
>> For more information see
>> http://www.kgbinternet.com/SpamFilter.htm
>> 
>> To control your spam filter, log in at
>> http://filter.kgbinternet.com
>> 
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message