Skip to content

Instantly share code, notes, and snippets.

@flimzy
Created August 17, 2020 16:54
Show Gist options
  • Save flimzy/e4df7619c6aa16928009969abdec4ce7 to your computer and use it in GitHub Desktop.
Save flimzy/e4df7619c6aa16928009969abdec4ce7 to your computer and use it in GitHub Desktop.
# This is expected: The document exists with _rev 1-d005ccb8dd54b45ab90d06a3b32513ca
$ curl -X GET http://admin:xxx@localhost:5984/lana-knowledge-items/_design/items_sync_v1\?deleted_conflicts=true
{"_id":"_design/items_sync_v1","_rev":"1-d005ccb8dd54b45ab90d06a3b32513ca","language":"javascript","views":{"by_owner_id":{"map":"\n\t\t\tfunction(d) {\n\t\t\t\tif (d['created_at']) {\n\t\t\t\t\temit(d.created_at, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t"}}}
# Now simulate replicating the deleted document, which appears to work just fine:
$ curl -X PUT http://admin:xxx@localhost:5984/lana-knowledge-items/_design/items_sync_v1\?new_edits=false -H 'Content-Type: application/json' -d'{"_id":"_design/items_sync_v1","_rev":"2-xx","_deleted":true}'
{"ok":true,"id":"_design/items_sync_v1","rev":"2-xx"}
# But fetch the document again, and it's not deleted, and `2-xx` is listed as a deleted conflict
$ curl -X GET http://admin:xxx@localhost:5984/lana-knowledge-items/_design/items_sync_v1\?deleted_conflicts=true
{"_id":"_design/items_sync_v1","_rev":"1-d005ccb8dd54b45ab90d06a3b32513ca","language":"javascript","views":{"by_owner_id":{"map":"\n\t\t\tfunction(d) {\n\t\t\t\tif (d['created_at']) {\n\t\t\t\t\temit(d.created_at, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t"}},"_deleted_conflicts":["2-xx"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment