Javascript function to save new fields from existing fields (migration) in mongodb collection -
Javascript function to save new fields from existing fields (migration) in mongodb collection - we have design alter in application accommodate few new requirements. design alter forced migrate 1 of mongodb collection, instead of having individual fields, have create derived json string field existing fields. the migration process invoked end-user doing action in ui (like saving change). 1 action might update few thousands of documents. write javascript code executed on server side, can avoid loading many records application. but issue running is, cannot phone call java script function using eval collection sharded. , other alternative cannot consider create collection un-sharded migration has happen on live system. please help if know of alternate approach. example migration : exampledoc (collection) has fields a1, a2, b1 , b2. migration create new fields called fieldjson : { : "", b : ""}. here , b derived existing fields a1, a2, b1 , b2. ...