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 76628C91B for ; Thu, 7 Jun 2012 14:40:06 +0000 (UTC) Received: (qmail 53516 invoked by uid 500); 7 Jun 2012 14:40:04 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 53473 invoked by uid 500); 7 Jun 2012 14:40:04 -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 53464 invoked by uid 99); 7 Jun 2012 14:40:04 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jun 2012 14:40:04 +0000 Received: from localhost (HELO mail-gg0-f180.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jun 2012 14:40:03 +0000 Received: by ggnf1 with SMTP id f1so478362ggn.11 for ; Thu, 07 Jun 2012 07:40:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.181.232 with SMTP id dz8mr977194igc.72.1339080002689; Thu, 07 Jun 2012 07:40:02 -0700 (PDT) Received: by 10.42.106.199 with HTTP; Thu, 7 Jun 2012 07:40:02 -0700 (PDT) In-Reply-To: References: Date: Thu, 7 Jun 2012 15:40:02 +0100 Message-ID: Subject: Re: How to add IP address field to documents From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The signature for validate_doc_update is; (newDoc, oldDoc, userCtx, secObj) The request is not exposed (and thus you can't find the IP of the client). B. On 7 June 2012 15:25, Pulkit Singhal wrote: > I would like to add an additional field to incoming documents in the > validate_doc_field method. This field should store client info like the I= P > address. I hope that folks reading this thread find this to be same as > adding a created_at or last_modified timestamps. And ofcourse the minor > difference is that timestamps can be generated but for something like > client ip address, it would have to be picked-up/passed-in from somewhere= . > > I'm using CouchDB 1.2.0 and I'm used to the following method signature: > function (new_doc, old_doc, userCtx) {...} > > But while Google~ing I have found two threads that hint at the existence = of > a different validation signature: > =A01. > http://grokbase.com/t/couchdb/user/094xjv2zaz/validate-doc-update-modifyi= ng-doc > =A02. https://issues.apache.org/jira/browse/COUCHDB-1287 > > Does this new signature actually exist in 1.2.0 or not? > function (new_doc, old_doc, userCtx, http_headers) {...} > > Overall are there any suggestion on how to add an IP address field to > documents on the fly?