From user-return-13100-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Fri Oct 08 22:51:57 2010 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 58786 invoked from network); 8 Oct 2010 22:51:56 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Oct 2010 22:51:56 -0000 Received: (qmail 47096 invoked by uid 500); 8 Oct 2010 22:51:55 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 47048 invoked by uid 500); 8 Oct 2010 22:51:54 -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 47040 invoked by uid 99); 8 Oct 2010 22:51:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Oct 2010 22:51:54 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.214.180 as permitted sender) Received: from [209.85.214.180] (HELO mail-iw0-f180.google.com) (209.85.214.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Oct 2010 22:51:48 +0000 Received: by iwn40 with SMTP id 40so1894051iwn.11 for ; Fri, 08 Oct 2010 15:51:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=3vr9fHb8zNPvlh9S+YWvdrMx/lD4+Zca+J7E3kqUwJI=; b=swKDxewX9SC6AYx/HQ1ppyzjgZNpNuwRcLaKeAeGFAk7oEI7K3Ww3E0aCaCU+lDxkH St5dS+4VhjIEeMPsp6jfr7yPMZn5UQWjR9t0UX6Kdfn7WSI/pudpr/rd7Dm58qJeO4gC Bb3QMzZHqWvEUYLAuhJ93CDYatiuAOiwSzR3M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=fbUs5jMJ5m9/JiCyha7m8Nr+y+Gdw8qYhjW5tvjBFfdVlEpsUx4i+yr3My4ZuWX81d OuGlpBDSiK5xj1Eg/w69f3J4Ofk6hBKVdpHLiW9Zm5Kur+CRWbGdrgXKMovC+EzcRB07 kr3knIqYFs/76/LCgPBBMe3MRTrMkGNIbj9zo= Received: by 10.231.173.144 with SMTP id p16mr2898443ibz.108.1286578287141; Fri, 08 Oct 2010 15:51:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.30.194 with HTTP; Fri, 8 Oct 2010 15:50:47 -0700 (PDT) In-Reply-To: References: From: Paul Davis Date: Fri, 8 Oct 2010 18:50:47 -0400 Message-ID: Subject: Re: Support _id and _rev being null on a POST To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On Fri, Oct 8, 2010 at 6:43 PM, John Logsdon wrote: > Hi > > I'd like to be able to support the following scenario: > > curl -XPOST -H"Content-Type: application/json" http://localhost:5984/uta -d > '{"_id": null, "_rev":null,"x":"y"}' > > Which returns: > > {"error":"bad_request","reason":"Document id must be a string"} > > I'd like the above to work the same as this command: > > curl -XPOST -H"Content-Type: application/json" http://localhost:5984/uta -d > '{"x":"y"}' > > which returns: > > {"ok":true,"id":"c9fd97f3eb58fdb62ef7a80440001662","rev":"1-935564bc7ec7e86aa82ecec3face18f6"} > > > Is there a reason why couchdb doesn't do the same action on a null _id/_rev > as it does when the fields aren't present? > > Regards > > John > A value of null is not equivalent to no value. Null is a value and its not a valid document id. Hence, the error. I don't like the idea of silently discarding it and creating a new document with a random doc id. I can see this causing lots of headaches when someone has a bug and doesn't realize their code is just creating random documents. Paul Davis