Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 67458 invoked from network); 7 Aug 2009 12:20:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Aug 2009 12:20:11 -0000 Received: (qmail 29653 invoked by uid 500); 7 Aug 2009 12:20:17 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 29558 invoked by uid 500); 7 Aug 2009 12:20:16 -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 29548 invoked by uid 99); 7 Aug 2009 12:20:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Aug 2009 12:20:16 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of b.candler@pobox.com designates 208.72.237.25 as permitted sender) Received: from [208.72.237.25] (HELO sasl.smtp.pobox.com) (208.72.237.25) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Aug 2009 12:20:07 +0000 Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id E8D491E88; Fri, 7 Aug 2009 08:19:44 -0400 (EDT) Received: from mappit (unknown [80.45.95.114]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 81BFF1E87; Fri, 7 Aug 2009 08:19:42 -0400 (EDT) Received: from brian by mappit with local (Exim 4.69) (envelope-from ) id 1MZOQ9-0003tN-5K; Fri, 07 Aug 2009 13:19:41 +0100 Date: Fri, 7 Aug 2009 13:19:41 +0100 From: Brian Candler To: Antony Blakey Cc: user@couchdb.apache.org, Tim Somers Subject: Re: Properties with special characters Message-ID: <20090807121941.GB14661@uk.tiscali.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Pobox-Relay-ID: 9774105C-834C-11DE-A542-EAC21EFB4A78-28021239!a-pb-sasl-quonix.pobox.com X-Virus-Checked: Checked by ClamAV on apache.org On Fri, Aug 07, 2009 at 08:39:14PM +0930, Antony Blakey wrote: > > On 07/08/2009, at 8:25 PM, Tim Somers wrote: > >> function(doc) { >> if (doc.doc_type == "multiLangString") { >> emit(doc.default, { >> "default": doc.default, >> "en-GB": doc.en-GB, >> "fr-BE": doc.fr-BE, >> "nl-BE": doc.nl-BE >> }); >> } >> } > > In javascript, doc.en-GB is actually doc.en - GB i.e. a subtration > operation. > > You need to do this: > > "en-GB": doc['en-GB'], > "fr-BE": doc['fr-BE'], > "nl-BE": doc['nl-BE'] > > This is a general Javascript trap. And if it might not be present, then "en-GB": doc['en-GB'] || null, ... etc (otherwise you will get 'undefined' and couch-js falls over when trying to serialize it) You can of course just do emit(doc.default, doc); to get the whole document, or emit(doc.default, null); which emits no value, but since you have the docid you can query with ?include_docs=true HTH, Brian.