Couchdb Views erased in hosted servers

In our couchdb database we have ‘region’, ‘aire_de_sante’ and ‘district’ json keys attached for every doc with type person, we have not seen any cht api, that will allow us to retrieve all supervisors for a given region, so I build a view in couchdb with this code

function(doc) {
  if (doc.type === 'person' && doc.facilty_type == 'district_hospital' && doc.region) {
    emit(doc.region, {supervisor_uuid:doc._id,,supervisor_area_uuid:doc.parent._id});

With this we are able to get all supervisor of a given region with the API"MOPTI"
In the test instance , this is working fine, and our apps can interact with the cht
Once in production, with the same view in production, we get the view erased by administrators.
Could we know a little more about this ?
why does a simple couchdb view cause so much trouble that administrators delete it leaving view consumers with no data ?

Hi @bamatic

Do you maybe remember which design document you added the view to?

Some design documents come with the CHT and are required for correct functionality, and are maintained by our team. As part of the upgrade process, the design documents that are part of the CHT are overwritten with the upgraded version. This process is would delete additional views that were added manually. If you added your view to one of the cht design documents, and performed an upgrade, it’s expected that your view has been deleted.

This is one case where views will get deleted by a CHT process.
If your views we created in new design documents, then they should not be deleted by an upgrade.
I can’t answer as to why someone would manually delete a view in a production server.

Oh, I’m noticing some of my questions are already answered by your post, sorry for not noticing this before. Did you, by any chance, perform an upgrade recently? The medic-client design document would be overwritten by the upgrade.

Thanks, No we have not done any upgrade.
Is there a way to know if the SRE team is having troubles with our view or should we try to add the view to a new ddoc ?

Can you please tell me what version you’re on? A server restart could also overwrite your design document.
But for good measure, could you please add the view to a new design document?

Ok thanks, we’re using 3.15.0
We will try to add the view to a new ddoc.
note that in our test instance the view is in the medic-client ddoc, since several days, and this instance is also on 3.15.0

A server restart could also overwrite your design document.

This server was restarted yesterday. The services had crashed due to disk space running out. It went from 85% to 100% used space over 1 day. I’ll take down the project this afternoon to increase disk size.


Thanks a lot for this @hareet and @diana ,
could you let us now when you will be done with the disk size increasing ?

Disk space was increased. The issue should be resolved, current usage is 35%. We will work on catching this earlier and modify our alert thresholds. Thanks for your understanding.