Я создал скрипт :
db.people.update({degree1:"Other"}, { $rename : { "degree1_other" : "degree1" } }, false, true )
db.people.update({degree2:"Other"}, { $rename : { "degree2_other" : "degree2" } }, false, true )
db.people.update({degree3:"Other"}, { $rename : { "degree3_other" : "degree3" } }, false, true )
db.people.find({degrees:null}).forEach( function (doc) {
doc.degrees = { "first" : doc.degree1, "second" : doc.degree2, "third" : doc.degree3 };
db.people.save(doc);
});
db.people.update({degree1: {$exists : true}},{$unset:{degree1:1}},false,true)
db.people.update({degree1_other: {$exists : true}},{$unset:{degree1_other:1}},false,true)
db.people.update({degree2: {$exists : true}},{$unset:{degree2:2}},false,true)
db.people.update({degree2_other: {$exists : true}},{$unset:{degree2_other:2}},false,true)
db.people.update({degree3: {$exists : true}},{$unset:{degree3:3}},false,true)
db.people.update({degree3_other: {$exists : true}},{$unset:{degree3_other:3}},false,true)
Он запускается в течение нескольких секунд.