1 |
57497
|
konstantin
|
//version compatibility: 2.0.0-SNAPSHOT
|
2 |
|
|
|
3 |
|
|
function removeStatisticsForDeletedCommunity(pid) {
|
4 |
|
|
var countStatistics = db.statistics.find({pid: pid}).count();
|
5 |
|
|
if(countStatistics > 0) {
|
6 |
|
|
db.statistics.remove({pid: pid});
|
7 |
|
|
}
|
8 |
|
|
print("Removed " + countStatistics + " statistics entries for community: " + pid);
|
9 |
|
|
}
|
10 |
|
|
|
11 |
|
|
function removeSubscribersForDeletedCommunity(pid) {
|
12 |
|
|
var countSubscribers = db.communitySubscribers.find({pid: pid}).count();
|
13 |
|
|
if(countSubscribers > 0) {
|
14 |
|
|
db.communitySubscribers.remove({pid: pid});
|
15 |
|
|
}
|
16 |
|
|
print("Removed " + countSubscribers + " communitySubscribers entries for community: " + pid);
|
17 |
|
|
}
|
18 |
|
|
|
19 |
|
|
use openaire_admin;
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
// 08-10-2019
|
23 |
|
|
removeStatisticsForDeletedCommunity("Transport Research");
|
24 |
|
|
removeSubscribersForDeletedCommunity("Transport Research");
|
25 |
|
|
|
26 |
|
|
removeStatisticsForDeletedCommunity("European Plate Observing System");
|
27 |
|
|
removeSubscribersForDeletedCommunity("European Plate Observing System");
|