Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ECFDD9324 for ; Fri, 27 Jan 2012 04:15:34 +0000 (UTC) Received: (qmail 69467 invoked by uid 500); 27 Jan 2012 04:15:33 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 68865 invoked by uid 500); 27 Jan 2012 04:15: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 68837 invoked by uid 99); 27 Jan 2012 04:15:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jan 2012 04:15:21 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [198.235.201.17] (HELO barracuda.northwestel.ca) (198.235.201.17) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jan 2012 04:15:12 +0000 X-ASG-Debug-ID: 1327637686-04700c580e1b790001-z14J5S Received: from [192.168.1.102] ([199.247.191.174]) by barracuda.northwestel.ca with ESMTP id 6zP02QqCdtGEa8AJ for ; Thu, 26 Jan 2012 20:14:46 -0800 (PST) X-Barracuda-Envelope-From: stephan@bardubitzki.com X-Barracuda-Apparent-Source-IP: 199.247.191.174 Message-ID: <4F2224BB.6010800@bardubitzki.com> Date: Thu, 26 Jan 2012 20:14:51 -0800 From: Stephan Bardubitzki User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111229 Thunderbird/9.0 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Re: _design doc issue References: <4F22108B.6040302@bardubitzki.com> X-ASG-Orig-Subj: Re: _design doc issue In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Barracuda-Connect: UNKNOWN[199.247.191.174] X-Barracuda-Start-Time: 1327637686 X-Barracuda-URL: http://198.235.201.17:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at northwestel.ca X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=6.8 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.86801 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Virus-Checked: Checked by ClamAV on apache.org Thanks for your reply CGS. I have use single quota in the first place causing the same issue. Any more thoughts? Stephan On 12-01-26 08:08 PM, CGS wrote: > Use single quota ( ' ) instead of escape character and double quota.(\"). > For some reasons I don't know, the JSON parser is no capable of > interpreting \" as it should. > > CGS > > > > > On Fri, Jan 27, 2012 at 3:48 AM, Stephan Bardubitzki< > stephan@bardubitzki.com> wrote: > >> I'm quite new to CouchDB and have to struggle with the following issue >> using Futon: >> >> In 'temporary view' this code does what I want to get out: >> >> function(doc) { >> var today = new Date(); >> var month = today.getMonth(); >> var room, chatrooms = []; >> for ( room in doc.room ) { >> if ( doc.room[room].duration === 'seasonal' || >> doc.room[room].duration === 'ones' ) { >> if ( doc.room[room].start< doc.room[room].end ) { >> if( doc.room[room].start<= month&& doc.room[room].end>= month >> ) { >> chatrooms.push(doc.room[room])**; >> } >> } >> else { >> if( doc.room[room].start>= month&& doc.room[room].end>= month >> ) { >> chatrooms.push(doc.room[room])**; >> } >> } >> } >> else { >> chatrooms.push(doc.room[room])**; >> } >> >> } >> emit(doc._id, chatrooms); >> } >> >> However, if I add this to the _design doc Futon will not save the document. >> FF says: JSON.parse: bad control character in string literal. >> >> My _design doc looks like this: >> >> { >> "_id": "_design/chat-categories", >> "_rev": "9-**d5bca128d1fb98545691d78fa6aff9**bb", >> "views": { >> "categories": { >> "map": "function(doc) { >> var today = new Date(); >> var month = today.getMonth(); >> var room, chatrooms = []; >> for ( room in doc.room ) { >> if ( doc.room[room].duration === \"seasonal\" || >> doc.room[room].duration === \"ones\" ) { >> if ( doc.room[room].start< doc.room[room].end ) { >> if( doc.room[room].start<= month&& >> doc.room[room].end>= month ) { >> chatrooms.push(doc.room[room])**; >> } >> } >> else { >> if( doc.room[room].start>= month&& >> doc.room[room].end>= month ) { >> chatrooms.push(doc.room[room])**; >> } >> } >> } >> else { >> chatrooms.push(doc.room[room])**; >> } >> } >> emit(doc._id, chatrooms); >> }" >> } >> } >> } >> >> What do I miss? >> >> Thanks. >> >> > -------------------------------- > Spam/Virus scanning by CanIt Pro > > For more information see > http://www.kgbinternet.com/SpamFilter.htm > > To control your spam filter, log in at > http://filter.kgbinternet.com >