From couchdb-user-return-2056-apmail-incubator-couchdb-user-archive=incubator.apache.org@incubator.apache.org Mon Dec 01 16:30:12 2008 Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 5562 invoked from network); 1 Dec 2008 16:30:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Dec 2008 16:30:11 -0000 Received: (qmail 48186 invoked by uid 500); 1 Dec 2008 16:30:22 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 48144 invoked by uid 500); 1 Dec 2008 16:30:22 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 48133 invoked by uid 99); 1 Dec 2008 16:30:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2008 08:30:22 -0800 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 jrhuggins@gmail.com designates 209.85.221.10 as permitted sender) Received: from [209.85.221.10] (HELO mail-qy0-f10.google.com) (209.85.221.10) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2008 16:28:53 +0000 Received: by qyk3 with SMTP id 3so1577237qyk.12 for ; Mon, 01 Dec 2008 08:29:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=Af+UrO6uUw8q6AtBweby04/YIsV8zgpDwFE22iLQCdA=; b=ZVAQ4J3YMV1SkU/QPeMWvc+QGUrzvwbLH3eIHmDp9jwFC+TVm+970h3iWmBvBYCgBh hztuAkaZiBx7+P5P1hNmdcXTJvzHNICXIprs3BVNmVk+c/DNX9mwRCVX0rWLOc6bY6Zp l+xAhv1x0MhKDzrGTaAWsOqcJvX3/BrzT1d/c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=J7EBomxe+aJnrSIsOLqo5BD6kcG4nwFCUDhfZNUyPUM184dJTRunQfQ7qtdwfE8Euu VoiC83Gvew3CR3bT8mBDwB7jGb2711BTbLT5S2jmWavmKzqTAz5aIlGZ3K6F6dAm0hUB zfdu+iDyRJourOzLcZEb7anWFFB5XCfZPXWzo= Received: by 10.215.41.14 with SMTP id t14mr9920793qaj.338.1228148979870; Mon, 01 Dec 2008 08:29:39 -0800 (PST) Received: by 10.215.14.3 with HTTP; Mon, 1 Dec 2008 08:29:39 -0800 (PST) Message-ID: <53b9568a0812010829n49ce2eebl89419e5db0b536a4@mail.gmail.com> Date: Mon, 1 Dec 2008 10:29:39 -0600 From: "Jason Huggins" Sender: jrhuggins@gmail.com To: couchdb-user@incubator.apache.org Subject: Auto-adding additional fields on PUT/POST? (datetime stamps) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: 583ee4a8cd20e92e X-Virus-Checked: Checked by ClamAV on apache.org Hello all! I would like some meta-data to get inserted into documents when my users create them. At a minimum, something like Created and LastModified datetime stamps would be nice. Currently, the users have to manually add these fields when they POST or PUT. Ideally, there is something I can do on the server side to "automagically" add those fields for them. I think the easiest thing to do is to create a DBNotificationUpdate script that looks for new documents and updates them with the datetime data as a document revision. Is there a better way to handle this? I think I want something like what happens now with the creation of the "_id" field... If "_id" is missing, CouchDB will add it to the document on the user's behalf at document creation time. Thanks, and happy couching! -jason http://saucelabs.com