To transfer data from mysql to mongodb 1st create a backup of mysql database as a json file.
You can export data as a json file from phpmyadmin.
Then edit the json file, Remove the additional information and keep only json array.
Then from terminal you can import data to mongodb using the following command:
mongoimport --db dbname --collection collname --type json --file filename.json --jsonArray
For string to int conversion.
db.my_collection.find().forEach( function(obj) {
obj.my_value= new NumberInt(obj.my_value);
db.my_collection.save(obj);
});
For string to double conversion.
obj.my_value= parseInt(obj.my_value, 10);
For float:
obj.my_value= parseFloat(obj.my_value);