Couchdb database maintenance - kwantu/platformconfiguration GitHub Wiki

back

Couchdb database maintenance

Service to copy a db without any of the conflict revisions to a new database

https://kwantu.me/exist/rest/db/kwantu-resource/_tools/shallowCopyDatabase.xq?source=kwantu_apps_aaaaaaaaaaaa&target=kwantu_apps_bbbbbbbbbbbb


Service to deal with conflicts

https://staging.kwantu.net/exist/rest/db/kwantu-resource/api/rest/conflictedDocs.xq?case=index

There are three cases in there:

case=index (creates the index)

https://staging.kwantu.net/exist/rest/db/kwantu-resource/api/rest/conflictedDocs.xq?case=index

POST BLOCK :
{
  "communityId":"962dd628-36b5-4a41-b959-a6e8827b6a7e"
}

case=get (gets the list of conflicted documents)

https://staging.kwantu.net/exist/rest/db/kwantu-resource/api/rest/conflictedDocs.xq?case=get

POST BLOCK :
{
  "communityId":"962dd628-36b5-4a41-b959-a6e8827b6a7e",
  "skip":0,
  "limit":100,
  "sort":"true"
}

case=delete (deletes the older conflicted document)

https://staging.kwantu.net/exist/rest/db/kwantu-resource/api/rest/conflictedDocs.xq?case=delete

POST BLOCK :
{
  "communityId":"962dd628-36b5-4a41-b959-a6e8827b6a7e",
  "skip":0,
  "limit":100,
  "sort":"true"
}

Once you create the index you need to wait for some time so that couchdb created the index at backend. Try case=get to test if index is ready for deletion.