couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Somers <tim.som...@securysat.be>
Subject Re: Properties with special characters
Date Fri, 07 Aug 2009 12:09:27 GMT
On Fri, Aug 7, 2009 at 13:09, Antony Blakey <antony.blakey@gmail.com> 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.
>
> 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
>
>
That's what I thought, hence the \- part. I didn't know this syntax though,
thank for the help!

Tim

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message