Skip to content

Instantly share code, notes, and snippets.

View flimzy's full-sized avatar

Jonathan Hall flimzy

View GitHub Profile
var C interface{}
if true {
C = new(A)
} else {
C = new(B)
}
function getErrorMessage(response) {
if (!response.originalError.response)
return 'network error';
return response.originalError.response.data.errorMessage;
}
# 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