db.yourCollection.find().forEach(
   function(m){ 
     if(m.data === null){
       m.data = 0;
       print(m._id)
       db.yourCollection.save(m);
     }
     else if(m.data === undefined){
       m.data = 0;
       print(m._id)
       db.yourCollection.save(m);
     }
     else{
       m.data = Math.round(m.data * 100)/100
       db.yourCollection.save(m);
     }
 })
Advertisements