-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathduplicates.js
More file actions
33 lines (30 loc) · 1007 Bytes
/
duplicates.js
File metadata and controls
33 lines (30 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
["item","ability","knowledge","player","entity","race","archetype"].forEach(function(t) {db[t].find().forEach(function(doc) {if(db[t].find({"id":doc.id}).count() !== 1) {print(t + " -> " + doc.id);}});})
var collection,
found = {};
db.getCollectionNames().forEach(function(name) {
if(name.indexOf(".") === -1 && name[0] !== "_") {
collection = db.getCollection(name);
collection.find().sort({"updated":-1}).forEach(function(doc) {
if(!found[doc.id]) {
found[doc.id] = true;
} else {
print("Removed[" + name + "]: " + doc.id + " @" + doc.updated);
collection.remove({"_id":doc._id});
}
});
}
});
var collection,
found = {};
db.getCollectionNames().forEach(function(name) {
if(name.indexOf(".") === -1 && name[0] !== "_") {
collection = db.getCollection(name);
collection.find().sort({"updated":-1}).forEach(function(doc) {
if(!found[doc.id]) {
found[doc.id] = true;
} else {
print("Issue[" + name + "]: " + doc.id + " @" + doc.updated);
}
});
}
});