Skip to content

Instantly share code, notes, and snippets.

@rnewson
Created August 14, 2014 16:45
Show Gist options
  • Save rnewson/6835ea514f7ca5db0c43 to your computer and use it in GitHub Desktop.
Save rnewson/6835ea514f7ca5db0c43 to your computer and use it in GitHub Desktop.
Last login: Thu Aug 14 17:17:56 on ttys001
cur% ➜ ~ curl localhost:5984/db1 -XPUT
{"ok":true}
➜ ~ curl localhost:5984/db1/foo+bar -XPUT -d{}
{"ok":true,"id":"foo bar","rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl localhost:5984/db1/foo%2bbar -XPUT -d{}
{"ok":true,"id":"foo+bar","rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl localhost:5984/db1/foo%2bbar
{"_id":"foo+bar","_rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl localhost:5984/db1/_changes
{"results":[
{"seq":1,"id":"foo bar","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]},
{"seq":2,"id":"foo+bar","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
],
"last_seq":2}
➜ ~ curl 'localhost:5984/db1/_changes?filter=_doc_ids&doc_ids=["g"]'
curl: (3) [globbing] illegal character in range specification at pos 54
➜ ~ curl -g 'localhost:5984/db1/_changes?filter=_doc_ids&doc_ids=["g"]'
{"results":[
],
"last_seq":2}
➜ ~ curl -g 'localhost:5984/db1/_changes?filter=_doc_ids&doc_ids=["foo bar"]'
➜ ~ curl -g 'localhost:5984/db1/_changes?filter=_doc_ids&doc_ids=["foo+bar"]'
{"results":[
{"seq":1,"id":"foo bar","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
],
"last_seq":2}
➜ ~ curl -g 'localhost:5984/db1/_changes?filter=_doc_ids&doc_ids=["foo%2bbar"]'
{"results":[
{"seq":2,"id":"foo+bar","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
],
"last_seq":2}
➜ ~ curl -g 'localhost:5984/db1/_changes?filter=_doc_ids' -d '{"doc_ids, ["foo%2bbar"]}'
{"error":"bad_content_type","reason":"Content-Type must be application/json"}
➜ ~ curl -g 'localhost:5984/db1/_changes?filter=_doc_ids' -d '{"doc_ids, ["foo%2bbar"]}' -Hcontent-type:application/json
{"error":"bad_request","reason":"invalid_json"}
➜ ~ curl -g 'localhost:5984/db1/_changes?filter=_doc_ids' -d '{"doc_ids":["foo%2bbar"]}' -Hcontent-type:application/json
{"results":[
],
"last_seq":2}
➜ ~ curl -g 'localhost:5984/db1/_changes?filter=_doc_ids' -d '{"doc_ids":["foo+bar"]}' -Hcontent-type:application/json
{"results":[
{"seq":2,"id":"foo+bar","changes":[{"rev":"1-967a00dff5e02add41819138abb3284d"}]}
],
"last_seq":2}
➜ ~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment