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 3586C10131 for ; Tue, 17 Sep 2013 14:30:29 +0000 (UTC) Received: (qmail 31738 invoked by uid 500); 17 Sep 2013 14:30:28 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 31020 invoked by uid 500); 17 Sep 2013 14:30:27 -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 31012 invoked by uid 99); 17 Sep 2013 14:30:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Sep 2013 14:30:26 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of suraj.kumar@inmobi.com designates 209.85.223.177 as permitted sender) Received: from [209.85.223.177] (HELO mail-ie0-f177.google.com) (209.85.223.177) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Sep 2013 14:30:19 +0000 Received: by mail-ie0-f177.google.com with SMTP id qd12so10240083ieb.36 for ; Tue, 17 Sep 2013 07:29:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=oDlDPqeWweDnsEsO7Gd8nbw1SOo9Xu+u90SsxcvdTvE=; b=CQYkQtWw3BRRkjOCn9/LU6YDLRflBJEAD+b7N8cmdaAz7qk84mSRAqflCeA7U5oI1N K1KSqISLbqU+qw+tf2Ar/gSvXq04J1192D6fcyTr+yls5byG/wrwLWIB1tne3Ex974yQ javDA+3lhWhjFPxDFATwcWSs4xu0FASrGAwI87Gu/i74CdKM7/2fXP7h1XMxAJes7q9x AQ7nkZbE9o3tFIuJmYzBBBGU1r3UaAcoFtji+7k/hxK0kIicdzLBLSFi8TMTkR10odid eeR+MBXz6tPrWrvNrxUQgcWttfOWbVw2Dl6DUdtqqWjGWXHDR2zpBVNrrSM1LEDiu6fC teLg== X-Gm-Message-State: ALoCoQnAiWQTOEdjZ6ZwC6bwVDzQD2aU0nCHc4mZh8LTA4DBWFED7p0S6J0xbAko2wLxUsZlCqW/05pm5DA8RIGZmq3FfgsM84QqVaivqmvnCybwSSdpKuc= MIME-Version: 1.0 X-Received: by 10.43.130.135 with SMTP id hm7mr258532icc.33.1379428198223; Tue, 17 Sep 2013 07:29:58 -0700 (PDT) Received: by 10.64.224.244 with HTTP; Tue, 17 Sep 2013 07:29:58 -0700 (PDT) Date: Tue, 17 Sep 2013 19:59:58 +0530 Message-ID: Subject: Change document in validate_doc_update From: Suraj Kumar To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=20cf307f30c8bfac0c04e695274c X-Virus-Checked: Checked by ClamAV on apache.org --20cf307f30c8bfac0c04e695274c Content-Type: text/plain; charset=US-ASCII I'd like to add extra fields to the document being created, just like how _user works. These I'd like to be able to compute using the inputs provided by the user, in perhaps, something like a validate function. I tried doing the following, in many different variations, knowing well that this is only wishful thinking... and as expected, it didn't work: function (newDoc, oldDoc, userCtx) { newDoc['newField'] = 10; return newDoc; } But I'd very much like to do what the _user database does - where by setting password, the document ends up getting different fields. How is it achieved? How can end users like me achieve the same for my business logic and altogether bypass the need to write middleware code? (I'm having to write middle ware code just to transform one json hash into another because my system is a pure API. CouchApps won't just do it (complex, already-existent-clients will use the API)). Regards, -Suraj -- An Onion is the Onion skin and the Onion under the skin until the Onion Skin without any Onion underneath. -- _____________________________________________________________ The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorized to receive it. It may contain confidential or legally privileged information. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. The firm is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. --20cf307f30c8bfac0c04e695274c--