Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 90657 invoked from network); 3 Aug 2009 11:11:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Aug 2009 11:11:12 -0000 Received: (qmail 23027 invoked by uid 500); 3 Aug 2009 11:11:16 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 22947 invoked by uid 500); 3 Aug 2009 11:11:16 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 22937 invoked by uid 99); 3 Aug 2009 11:11:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Aug 2009 11:11:16 +0000 X-ASF-Spam-Status: No, hits=2.7 required=10.0 tests=NORMAL_HTTP_TO_IP,SPF_NEUTRAL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [83.97.50.139] (HELO jan.prima.de) (83.97.50.139) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Aug 2009 11:11:06 +0000 Received: from [192.168.1.14] (f053005045.adsl.alicedsl.de [::ffff:78.53.5.45]) (AUTH: LOGIN jan, SSL: TLSv1/SSLv3,128bits,AES128-SHA) by jan.prima.de with esmtp; Mon, 03 Aug 2009 11:10:45 +0000 Message-Id: <42E1E336-66E6-4A26-AFB2-2C92D4BF564C@apache.org> From: Jan Lehnardt To: dev@couchdb.apache.org In-Reply-To: <20090803090423.GA8374@uk.tiscali.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: POST with _id Date: Mon, 3 Aug 2009 13:10:42 +0200 References: <20090803090423.GA8374@uk.tiscali.com> X-Mailer: Apple Mail (2.935.3) X-Virus-Checked: Checked by ClamAV on apache.org On 3 Aug 2009, at 11:04, Brian Candler wrote: > Is there any reason why, if you POST a document to a database and that > document has an "_id" member, why this is ignored and a server- > generated _id > is used instead? > > $ curl -X PUT http://127.0.0.1:5984/sample > {"ok":true} > $ curl --data-binary '{"_id":"foo","bar":"baz"}' -X POST http://127.0.0.1:5984/sample > {"ok > ":true,"id":"f38341efa1ca9bebc528b452aa036846","rev":"1-4165745669"} The API for creating a named document is PUT /db/docid POSTing to /db is "add to a collection and let the server care about identity." > This seems inconsisent with a POST to _bulk_docs > > $ curl --data-binary '{"docs":[{"_id":"foo","bar":"baz"}]}' -X POST http://127.0.0.1:5984/sample/_bulk_docs > [{"id":"foo","rev":"1-1298018621"}] Bulk docs is different API. -- That's the reasons. Do you propose a change? :) Cheers Jan --