Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 16796 invoked from network); 19 Feb 2010 05:31:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Feb 2010 05:31:30 -0000 Received: (qmail 4113 invoked by uid 500); 19 Feb 2010 05:31:29 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 3864 invoked by uid 500); 19 Feb 2010 05:31:28 -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 3854 invoked by uid 99); 19 Feb 2010 05:31:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Feb 2010 05:31:28 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mrtrick@gmail.com designates 209.85.211.190 as permitted sender) Received: from [209.85.211.190] (HELO mail-yw0-f190.google.com) (209.85.211.190) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Feb 2010 05:31:18 +0000 Received: by ywh28 with SMTP id 28so3949741ywh.29 for ; Thu, 18 Feb 2010 21:30:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=fuVKNggbn5iAYBZryYjkf+EuxaBkFBn/hQVi9k0LqGA=; b=TOxq+96uzeWsffo+AoWKw4G1zOgkk22ZoPJLmUMrd/ETb0HDDOtfaXECc+thUL7GuI FyijZGcfyjs/JXUwXKikF5/rPDmpadMKfaToshPd1ATa22kcuXLmmQyxLSKq7llaBfJ2 HsrNs1PZ3Ofyf1FuDYyxZ8go0+2TGPF0iWqfA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=cw7SoznFD1m2lzEdy+YLEXDw0ypRKY11J+058GmBVnw6LJEslDjNSnyHtm5k4HPuyA ITE948DH0MwmubwBOSmOF6EiQya3I3N2wN5/zmyb2n1UpodZFyKuN8U8HkWg9shFVInI 2nPr8yghKxxUCeK6AloegL5LXcusRBKLDju7E= Received: by 10.150.252.14 with SMTP id z14mr908986ybh.72.1266557457300; Thu, 18 Feb 2010 21:30:57 -0800 (PST) Received: from ?138.25.13.97? (dhcp-13-097.it.uts.edu.au [138.25.13.97]) by mx.google.com with ESMTPS id 4sm3995646yxd.52.2010.02.18.21.30.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 18 Feb 2010 21:30:56 -0800 (PST) Message-ID: <4B7E21FF.5050404@gmail.com> Date: Fri, 19 Feb 2010 16:30:39 +1100 From: Patrick Barnes User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Suspected view generator bug... Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I was tearing my hair out because this view: map: function(doc) { if (doc.doc_type=='group') { doc.path.pop(); emit(doc.path, doc.display_name); } } Was supposed to take one element off the end of the path array and using the array as a view key. However, when I triggered view creation it would remove TWO elements! Strangely, if I opened the view function from within futon, added some whitespace and re-ran the function it worked fine. There are two similar views that both use the doc.path.pop() call. I'm fairly confident that behind the scenes, the couchdb (trunk) view generator is a) sharing a single copy of each document between all the map functions. b) permitting map functions to modify that copy, meaning that subsequent map functions might get a CORRUPTED version of the document. Verdict? For now, I've rewritten my map functions to clone the array to a local var before I call path.pop(). -Patrick Barnes