Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 90309 invoked from network); 2 Mar 2010 17:05:48 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Mar 2010 17:05:48 -0000 Received: (qmail 42589 invoked by uid 500); 2 Mar 2010 17:05:43 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 42556 invoked by uid 500); 2 Mar 2010 17:05:43 -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 42548 invoked by uid 99); 2 Mar 2010 17:05:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Mar 2010 17:05:42 +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 jchris@gmail.com designates 209.85.220.209 as permitted sender) Received: from [209.85.220.209] (HELO mail-fx0-f209.google.com) (209.85.220.209) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Mar 2010 17:05:31 +0000 Received: by fxm1 with SMTP id 1so525122fxm.35 for ; Tue, 02 Mar 2010 09:05:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=wOkumBbSL6YQEV7iFIKCfgevljBDprlnNAcigZHqK9c=; b=m/wZG13Z5qUGZFbZUJoj4lMIOt+4dZ54R13c7dg9CQEWoNK554F5R1BzrdmSZQVJhT HgXRTQhDWk+1SjJEZjL5YK8iYWCxXC+ZsLT9RXNzTHQWog+v/r7d2t5h8ztvDZZwaowk FVSoz2hvf1GNQnc5QgjVMw0X1X0ieMdgnA/zg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=vJrmWBacB+xrSNXhMDl/bQWBIcWGcWPXI6bVJVNBvQ+0UPUD6xjTjXFl5hwml3SY3P Y4iwSmHQeLw7L79UfzdMEX6j3AkHet5MKzQpZUR4/h5gSWHnbX7X7W576J3h5wmWbJ20 D9g00Kyu/YOnGL58DF+zfRxTiXeHMszGcw3yw= Received: by 10.223.92.142 with SMTP id r14mr6808392fam.93.1267549510374; Tue, 02 Mar 2010 09:05:10 -0800 (PST) Received: from ?192.168.1.104? (c-98-248-172-14.hsd1.ca.comcast.net [98.248.172.14]) by mx.google.com with ESMTPS id 18sm7461448fks.35.2010.03.02.09.05.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 02 Mar 2010 09:05:08 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: Default values via _updates function From: J Chris Anderson In-Reply-To: <33bc4c3c1003020644h29348f8fgcb10c868ef962615@mail.gmail.com> Date: Tue, 2 Mar 2010 09:05:04 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <33bc4c3c1003011453p6815da72t5b3c5f419999522f@mail.gmail.com> <6547666A-820B-4D6C-B9E0-C698B061EDDE@sourcegarden.de> <33bc4c3c1003020644h29348f8fgcb10c868ef962615@mail.gmail.com> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1077) X-Virus-Checked: Checked by ClamAV on apache.org On Mar 2, 2010, at 6:44 AM, Jim Garvin wrote: > *Chris,* >=20 > Thanks for the response. >=20 > $ couchdb -V > couchdb - Apache CouchDB 0.10.1 >=20 > Judging by the CouchDB downloads > page, > I'm on the latest stable release. I was trying to get a sense of how = far > off 0.11 is, so I referred to the road > map which > looks like it might be out of date, and then to the JIRA > = issues > for > 0.11, which didn't really help either. >=20 > Is CouchDB a project where it would be ill-advised to run on "edge" to = get > some 0.11 features early? I'll try just updating SpiderMonkey, as you > suggested, first. You could also try applying this 1 line patch: = http://github.com/apache/couchdb/commit/82ff1a2b0a15dbe181221173f3013befab= 68f499 If you are running from a release package and not source, you'll be = editing the file=20 /usr/local/share/couchdb/server/main.js (you can tell you're in the right place because it'll say "do not edit = this file by hand" at the top. Don't worry about that, it's just warning = that your changes will be blown away by future couchdb installs. (which = will have the patch) Let us know how it goes. Chris >=20 > Thanks much. >=20 > *Mario*, >=20 > Also, thanks for the response. As a shot in the dark, I had tried = parseJSON > first to no avail. >=20 > Thanks again to both, > Jim >=20 >=20 > On Mon, Mar 1, 2010 at 6:06 PM, Mario Scheliga = wrote: >=20 >> Hi Jim, >>=20 >> forget my last answer... sorry just grepped the source.... i think = chris is >> right! >>=20 >> greetz >>=20 >> mario >>=20 >> Am 01.03.2010 um 23:53 schrieb Jim Garvin: >>=20 >> Hi All, >>>=20 >>> I'm trying to do server-side created_at timestamps via CouchDB's = _updates >>> features, but I'm having trouble creating a new document out of the = JSON >>> passed in the request body. My app doesn't allow updates to = existing >>> documents, only "inserts". Here's the very simple _updates = function: >>>=20 >>> function(doc, req) { >>> var newDoc =3D JSON.parse(req.body); >>> newDoc.created_at =3D new Date(); >>> return [newDoc, "FML"]; >>> } >>>=20 >>> When I POST a document to the appropriate _updates URL, I get an = error in >>> the log telling me that JSON is not defined: >>>=20 >>> [info] [<0.30422.5>] OS Process :: function raised error: = ReferenceError: >>> JSON is not defined >>>=20 >>> I wasn't able to find much reference on the web aside from: >>>=20 >>> = http://wiki.apache.org/couchdb/How_to_intercept_document_updates_and_perfo= rm_additional_server-side_processing >>> http://www.mikealrogers.com/archives/737 >>>=20 >>> In the mikealrogers.com post, the author uses JSON in his function, = but >>> obviously I'm having problems with that approach. Does anyone know = what a >>> proper way to convert the body of the POST a javascript object would = be? >>> (avoiding eval()). Also, taking a step back, is this the right = approach >>> for setting default values on a new document in CouchDB? >>>=20 >>> Thanks, >>> Jim >>>=20 >>=20 >>=20 >> -- >> Sourcegarden GmbH HR: B-104357 >> Steuernummer: 37/167/21214 USt-ID: DE814784953 >> Geschaeftsfuehrer: Mario Scheliga, Rene Otto >> Bank: Deutsche Bank, BLZ: 10070024, KTO: 0810929 >> Schoenhauser Allee 51, 10437 Berlin >>=20 >>=20