Skip to content

Instantly share code, notes, and snippets.

@nickva
Created June 22, 2022 05:16
Show Gist options
  • Select an option

  • Save nickva/115977e3f45f57bc87cae2c21d0c54f1 to your computer and use it in GitHub Desktop.

Select an option

Save nickva/115977e3f45f57bc87cae2c21d0c54f1 to your computer and use it in GitHub Desktop.
Add some views and docs then purge files
#!/bin/sh
http delete $DB/db
http put $DB/db'?q=4'
http put $DB/db/_design/d views:='{"v": {"map":"function(doc){emit(doc._id, 42);}"}}'
http put $DB/db/x a=b
http put $DB/db/y a=b
http put $DB/db/z a=b
http post $DB/db/_purge x:='["1-4b8a35d3f70a5962f86c6dd06ceb599c"]'
http get $DB2/db/_design/d/_view/v
http post $DB2/db/_bulk_docs new_edits:='false' docs:='[ {"_id":"a", "_revisions":{"start":3, "ids":["q","w","r"]}} ]'
http post $DB/db/_purge a:='["3-q", "1-r"]'
http post $DB2/db/_bulk_docs new_edits:='false' docs:='[ {"_id":"a", "_revisions":{"start":2, "ids":["k","l"]}} ]'
http post $DB/db/_purge a:='["2-k", "1-r"]'
http put $DB/db/_design/d'?rev=1-f9c617ce0e1b3b73050be5a4fcdf1e23' views:='{"v": {"map":"function(doc){emit(doc._id, 43);}"}}'
http post $DB2/db/_purge y:='["1-4b8a35d3f70a5962f86c6dd06ceb599c"]'
http get $DB/db/_design/d/_view/v
http post $DB2/db/_purge x:='["1-4b8a35d3f70a5962f86c6dd06ceb599c"]'
http get $DB/db/_design/d/_view/v
http post $DB2/db/_purge z:='["1-4b8a35d3f70a5962f86c6dd06ceb599c"]'
http get $DB/db/_design/d/_view/v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment