Skip to content

Instantly share code, notes, and snippets.

@rnewson
Created September 2, 2014 14:03
Show Gist options
  • Save rnewson/59e1b2b58a12223de75e to your computer and use it in GitHub Desktop.
Save rnewson/59e1b2b58a12223de75e to your computer and use it in GitHub Desktop.
#!/bin/sh
curl -X DELETE localhost:5984/foo
curl -X PUT localhost:5984/foo
echo "should be 1-4a7e4ae49c4366eaed8edeaea8f784ad"
curl -X PUT localhost:5984/foo/doc -d '{"foo": 1}'
echo "natural update should be 2-2ee767305024673cfb3f5af037cd2729"
curl -X PUT localhost:5984/foo/doc -d '{"foo": 2, "_rev":"1-4a7e4ae49c4366eaed8edeaea8f784ad"}'
curl -X DELETE localhost:5984/foo
curl -X PUT localhost:5984/foo
echo "should be 1-4a7e4ae49c4366eaed8edeaea8f784ad"
curl -X PUT localhost:5984/foo/doc -d '{"foo": 1}'
echo "'forced' update creates a new branch"
curl -X PUT 'localhost:5984/foo/doc?new_edits=false' -d '{"foo": 2, "_rev":"2-2ee767305024673cfb3f5af037cd2729"}'
echo "should be two open revs"
curl 'localhost:5984/foo/doc?open_revs=all'
echo "but 2- still wins"
curl 'localhost:5984/foo/doc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment