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
--