Skip to content

Commit 7931f15

Browse files
committed
- add knowledge capacity threats
1 parent 9c69b0d commit 7931f15

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
var deleteExisting = false;
2+
var result
3+
var newThreats = [
4+
"Knowledge/Capacity - Insufficient knowledge to inform appropriate management or intervention actions",
5+
"Knowledge/Capacity - Inadequate scientific and/or technological capacity"
6+
]
7+
8+
if (deleteExisting) {
9+
result = db.program.updateMany(
10+
{'config.meriPlanContents.template': 'extendedKeyThreats'},
11+
{
12+
"$pull": {
13+
'config.keyThreatCodes': {"$in": newThreats}
14+
}
15+
}
16+
)
17+
18+
print("Programs with threat removed: " + result.modifiedCount);
19+
}
20+
21+
result = db.program.updateMany(
22+
{'config.meriPlanContents.template':'extendedKeyThreats'},
23+
{
24+
"$push": {
25+
'config.keyThreatCodes': {
26+
"$each": newThreats,
27+
"$sort": 1
28+
}
29+
}
30+
}
31+
)
32+
print("Programs updated: " + result.modifiedCount);

0 commit comments

Comments
 (0)