Skip to content

Instantly share code, notes, and snippets.

@cliffano
Last active September 13, 2020 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cliffano/4545061 to your computer and use it in GitHub Desktop.
Save cliffano/4545061 to your computer and use it in GitHub Desktop.
CouchDB delete followed by bulk fetch against _replicator database
========================================================================
Step 1: Delete an existing doc in _replicator database.
request:
{ method: 'POST',
headers:
{ 'content-type': 'application/json',
accept: 'application/json' },
uri: 'http://user:pass@localhost:5984/_replicator/_bulk_docs',
body: '{"docs":[{"_id":"foo1","source":"http://user:pass@localhost:5984/mydb","target":"http://user:pass@localhost:5984/mydb2","continuous":true,"_rev":"59-abb0482eb5a5730d6a290a4c38206e96","_deleted":true}]}' }
response:
'[{"ok":true,"id":"foo1","rev":"60-e7613b16b1e4c22056f7aee3ed7f52fe"}]\n'
couch.log:
[info] [<0.107.0>] Canceling replication `28d7acf3a50221dc39ae27f229c7483e+continuous`...
[info] [<0.107.0>] Replication `28d7acf3a50221dc39ae27f229c7483e+continuous` canceled.
[info] [<0.107.0>] Stopped replication `28d7acf3a50221dc39ae27f229c7483e+continuous` because replication document `foo1` was deleted
========================================================================
Step 2: Bulk fetch _replicator database.
request:
{ method: 'POST',
headers:
{ 'content-type': 'application/json',
accept: 'application/json' },
uri: 'http://user:pass@localhost:5984/_replicator/_all_docs?include_docs=true',
body: '{"keys":["foo1"]}' }
response:
'{"total_rows":1,"offset":0,"rows":[\r\n{"id":"foo1","key":"foo1","value":{"rev":"60-e7613b16b1e4c22056f7aee3ed7f52fe","deleted":true},"doc":null}\r\n]}\n'
couch.log:
[info] [<0.1234.0>] 127.0.0.1 - - POST /_replicator/_all_docs?include_docs=true 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment