incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Blakey <antony.bla...@gmail.com>
Subject Re: Properties with special characters
Date Fri, 07 Aug 2009 11:09:14 GMT

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.

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Isn't it enough to see that a garden is beautiful without having to  
believe that there are fairies at the bottom of it too?
   -- Douglas Adams


Mime
View raw message