forked from camicroscope/Distro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mongo_uuid_conv.js
22 lines (21 loc) · 1 KB
/
mongo_uuid_conv.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// non-pathdb uuid fix attempt script
// run this script and it /should/ convert slide triple/case_id formats to the mongo object uuid slide references
db.slide.find({}).forEach(function(slide){
db.mark.find({'provenance.image.slide':slide.name, 'provenance.image.study':slide.study, 'provenance.image.specimen':slide.specimen}).forEach(function(mark){
delete mark.provenance.image.study
delete mark.provenance.image.specimen
mark.provenance.image.slide = slide._id.valueOf()
db.mark.save(mark)
})
db.heatmap.find({'provenance.image.slide':slide.name, 'provenance.image.study':slide.study, 'provenance.image.specimen':slide.specimen}).forEach(function(hm){
delete hm.provenance.image.study
delete hm.provenance.image.specimen
hm.provenance.image.slide = slide._id.valueOf()
db.heatmap.save(hm)
})
db.heatmap.find({'provenance.image.case_id':slide.name}).forEach(function(hm){
delete hm.provenance.image.case_id
hm.slide = slide._id.valueOf()
db.heatmap.save(hm)
})
})