Skip to content

Instantly share code, notes, and snippets.

@muhqu
Created October 7, 2010 10:38
Show Gist options
  • Select an option

  • Save muhqu/614939 to your computer and use it in GitHub Desktop.

Select an option

Save muhqu/614939 to your computer and use it in GitHub Desktop.
# creating 2 documents and deleting one of them
$ curl -X PUT 'http://127.0.0.1:5984/crap/thing-A' -d '{}'
{"ok":true,"id":"thing-A","rev":"1-967a00dff5e02add41819138abb3284d"}
$ curl -X PUT 'http://127.0.0.1:5984/crap/thing-B' -d '{}'
{"ok":true,"id":"thing-B","rev":"1-967a00dff5e02add41819138abb3284d"}
$ curl -X DELETE 'http://127.0.0.1:5984/crap/thing-B?rev=1-967a00dff5e02add41819138abb3284d'
{"ok":true,"id":"thing-B","rev":"2-eec205a9d413992850a6e32678485900"}
# checking for existence
$ curl -X GET 'http://127.0.0.1:5984/crap/thing-A'
{"_id":"thing-A","_rev":"1-967a00dff5e02add41819138abb3284d"}
$ curl -X GET 'http://127.0.0.1:5984/crap/thing-B'
{"error":"not_found","reason":"deleted"}
$ curl -X GET 'http://127.0.0.1:5984/crap/thing-C'
{"error":"not_found","reason":"missing"}
# all fine so far...
# checking existence with Bulk API
$ curl -X POST 'http://127.0.0.1:5984/crap/_all_docs' -d '{"keys":["thing-A","thing-B","thing-C"]}'
{"total_rows":25,"offset":0,"rows":[
{"id":"thing-A","key":"thing-A","value":{"rev":"1-967a00dff5e02add41819138abb3284d"}},
{"id":"thing-B","key":"thing-B","value":{"rev":"2-eec205a9d413992850a6e32678485900","deleted":true}},
{"key":"thing-C","error":"not_found"}
]}
# !unexpected!
# I would rather expect something like:
{"total_rows":25,"offset":0,"rows":[
{"id":"thing-A","key":"thing-A","value":{"rev":"1-967a00dff5e02add41819138abb3284d"}},
{"key":"thing-B","error":"not_found", "reason":"deleted"},
{"key":"thing-C","error":"not_found", "reason":"missing"}
]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment