Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D3E0D10DDC for ; Wed, 17 Jul 2013 19:23:27 +0000 (UTC) Received: (qmail 53001 invoked by uid 500); 17 Jul 2013 19:23:26 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 52795 invoked by uid 500); 17 Jul 2013 19:23:22 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 52783 invoked by uid 99); 17 Jul 2013 19:23:22 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jul 2013 19:23:22 +0000 Received: from localhost (HELO mail-vc0-f173.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jul 2013 19:23:21 +0000 Received: by mail-vc0-f173.google.com with SMTP id ht10so1677258vcb.18 for ; Wed, 17 Jul 2013 12:23:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=1Silmf8UxgoRvczQu23UqQ61uMgDx59UMq4HkSrxMGE=; b=GiITkc0y4T2IHcHDi3AB1S+VuWD2uL86US5TP9t44guQHTKiZpSS3+vqpkskMQVohs 2axvreZ+IHunPi8QlVOk8UGsFU464E2JpNZ4wrjSb77//bX9JbEhOGH/cjbj3K741EVq XLhaRO4lpH276HMsMZGqj34gBZMvjfr46NaAdgZDw1TYQ3telJ5mTAEqyPrd++mW4aA5 t+JjZxqn6ImKnX5hPmO7l4stuTkxIW1QxgE1SJowz7kMunrH6DqxmKZaA2Dbv5OGEUIp c7zTOTQ+hlBHolWXc4NFaZ4AzqDYGBQrVg6NEVGMpaBh18l5YiqrjmUqxwI+TNUaNjxX Yprw== MIME-Version: 1.0 X-Received: by 10.58.227.198 with SMTP id sc6mr2650154vec.59.1374089000928; Wed, 17 Jul 2013 12:23:20 -0700 (PDT) Received: by 10.220.149.73 with HTTP; Wed, 17 Jul 2013 12:23:20 -0700 (PDT) In-Reply-To: References: <51E6DFAD.4040009@bardubitzki.com> <51E6E32E.4070903@bardubitzki.com> <51E6E576.1030909@bardubitzki.com> Date: Wed, 17 Jul 2013 20:23:20 +0100 Message-ID: Subject: Re: View Collation From: Robert Newson To: "user@couchdb.apache.org" Content-Type: text/plain; charset=ISO-8859-1 Hah, good find! I've done that myself... On 17 July 2013 20:06, Jeff Snider wrote: > Sorry, that wasn't real clear without formatting. Here's what I mean: > > if (doc.kml_id && 'marker' in doc && doc.language) { > > or even > > if ('kml_id' in doc && 'marker' in doc && 'language' in doc) { > > > I think that should do what you want. > > > > > > On Jul 17, 2013, at 2:02 PM, Jeff Snider wrote: > >> 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 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" >>>>>> 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 >>>> >>> >> >