function deleteIndexParameters() { var indicators = db.indicator.find(); indicators.forEach(indicator => { indicator.indicatorPaths.forEach(path => { if(path.parameters) { delete path.parameters['index_id']; delete path.parameters['index_name']; delete path.parameters['index_shortName']; } db.indicator.save(indicator); }); }) } use irish-prod; deleteIndexParameters();