Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 23969 invoked from network); 11 May 2010 19:37:26 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 May 2010 19:37:26 -0000 Received: (qmail 89858 invoked by uid 500); 11 May 2010 19:37:25 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 89830 invoked by uid 500); 11 May 2010 19:37:25 -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 89822 invoked by uid 99); 11 May 2010 19:37:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 May 2010 19:37:25 +0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=AWL,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [66.46.182.58] (HELO relay.ihostexchange.net) (66.46.182.58) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 May 2010 19:37:20 +0000 Received: from VMBX122.ihostexchange.net ([192.168.40.2]) by hub108.ihostexchange.net ([66.46.182.58]) with mapi; Tue, 11 May 2010 15:36:57 -0400 From: Mike Keen To: "user@couchdb.apache.org" Date: Tue, 11 May 2010 15:36:55 -0400 Subject: Re: Strange integer anomaly in Erlang view Thread-Topic: Strange integer anomaly in Erlang view Thread-Index: AcrxQVFgyqaGCBdDQcyOppV/wSFfyw== Message-ID: <126D1B3E-8E6D-4AC9-B126-0C90E23307EE@visiture.com> References: <0B8367C6-CECE-48FB-AE62-1C270DE70221@visiture.com> <059B0C98-2D2F-4F09-A867-4D6ABFB1C335@apache.org> In-Reply-To: <059B0C98-2D2F-4F09-A867-4D6ABFB1C335@apache.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Adam, That's the problem. I feel a little stupid, but I appreciate the nudge in t= he right direction! Mike On May 11, 2010, at 3:23 PM, Adam Kocoloski wrote: > Hi Mike, are you sure this is what you want? >=20 >> [Emit(proplists:get_value(<<"id">>, StrippedCampaign, null), Campaig= n) || Campaign <- AdwordsCampaigns, {StrippedCampaign} <- AdwordsCampaigns]= ; >=20 > Try it in the emulator >=20 > 1> Foo =3D [1,2,3]. > [1,2,3] > 2> [{X,Y} || Y <- Foo, X <- Foo]. > [{1,1},{2,1},{3,1},{1,2},{2,2},{3,2},{1,3},{2,3},{3,3}] >=20 > You're generating combinatoric pairs of all elements of AdwordsCampaigns,= pulling the key from the first element of the pair and the value from the = second part of the pair. Perhaps you're looking for this instead? >=20 > [Emit(proplists:get_value(<<"id">>, Campaign, null), {Campaign}) || Campa= ign <- AdwordsCampaigns]; >=20 > Best, Adam >=20 > On May 11, 2010, at 2:58 PM, Mike Keen wrote: >=20 >> You're right. In the value column, the id shows up as 50573744 which is = the correct value. In the key column, it shows up as 53518364. >>=20 >> On May 11, 2010, at 2:44 PM, Randall Leeds wrote: >>=20 >>> On Tue, May 11, 2010 at 11:40, Jarrod Roberson = wrote: >>>> On Tue, May 11, 2010 at 2:31 PM, Mike Keen wrote: >>>>=20 >>>>> I guess I'm confused as to why JavaScript is ever even involved when >>>>> writing views in Erlang. Excuse my ignorance, but does all JSON go th= rough >>>>> it? >>>>>=20 >>>>> Mike >>>>>=20 >>>>> read all the comments to that bug report, it is the JSON parser that >>>> conforms to the limitations of JavaScript. And everything goes thru th= e JSON >>>> parser. >>>>=20 >>>=20 >>> I think we're missing the point. Even if the erlang JSON parser >>> conforms to JSON's notion of numbers then I'd expect the id to be >>> transformed the same way for both the key and the value. >>>=20 >>> Maybe the key is implicitly treated as a string? Mike, which is the >>> "correct" value for the id? >>=20 >=20