couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
Subject Re: Where to add documentation for bulk updates
Date Mon, 23 Mar 2009 17:40:55 GMT
On Mon, Mar 23, 2009 at 09:59:56AM -0700, David Van Couvering wrote:
>    OK, thanks, I didn't read down far enough.  I fixed the conflict and
>    made some more updates to make the overall section more clean and
>    consistent, and added some more meat to the examples.

Cheers. Could you also fix the all-or-nothing documentation while you're at
it. Experimentation suggests it doesn't work if you add ?all_or_nothing=true
or ?all-or-nothing=true to the URL; rather you need to put
{"all_or_nothing":true} as part of the POSTed JSON.

Demo:

$ curl http://localhost:5984/
{"couchdb":"Welcome","version":"0.9.0a757393"}
$ DB="http://127.0.0.1:5984/tstconf"
$ curl -X PUT "$DB"
{"ok":true}
$ curl -X PUT -d '{"name":"fred"}' "$DB/person"
{"ok":true,"id":"person","rev":"1-877727288"}
$ curl -X POST -d '{"docs":[{"_id":"person","_rev":"1-877727288","name":"jim"}]}' "$DB/_bulk_docs?all_or_nothing=true"
[{"id":"person","rev":"2-3595405"}]
$ curl -X POST -d '{"docs":[{"_id":"person","_rev":"1-877727288","name":"trunky"}]}' "$DB/_bulk_docs?all_or_nothing=true"
[{"id":"person","error":"conflict","reason":"Document update conflict."}]
$ curl -X POST -d '{"docs":[{"_id":"person","_rev":"1-877727288","name":"trunky"}]}' "$DB/_bulk_docs?all-or-nothing=true"
[{"id":"person","error":"conflict","reason":"Document update conflict."}]

But:

$ curl -X POST -d '{"all_or_nothing":true,"docs":[{"_id":"person","_rev":"1-877727288","name":"trunky"}]}'
"$DB/_bulk_docs"
[{"id":"person","rev":"2-2835283254"}]
$ curl "$DB/person?conflicts=true"
{"_id":"person","_rev":"2-3595405","name":"jim","_conflicts":["2-2835283254"]}

Regards,

Brian.

Mime
View raw message