diff --git a/src/main/scripts/releases/4.2/adhoc/addIsDefaultToGeoGraphicInfo.js b/src/main/scripts/releases/4.2/adhoc/addIsDefaultToGeoGraphicInfo.js new file mode 100644 index 000000000..58290ea46 --- /dev/null +++ b/src/main/scripts/releases/4.2/adhoc/addIsDefaultToGeoGraphicInfo.js @@ -0,0 +1,12 @@ +load('../../../utils/audit.js'); +var userId = "system"; +db.project.find({"geographicInfo": {$exists: true}, + "geographicInfo.isDefault": {$exists: false}} +).forEach(function(project) { + if (project.geographicInfo && project.geographicInfo.isDefault === undefined) { + project.geographicInfo.isDefault = false; + db.project.save(project); + audit(project, project.projectId, 'au.org.ala.ecodata.Project', userId, undefined, "Update"); + print("Updated project: " + project.projectId); + } +}); \ No newline at end of file