MongoHub-Mac
MongoHub-Mac copied to clipboard
DECIMAL columns are imported as String from MySQL
When importing from a MySQL table DECIMAL columns are imported as String despite of their lenght.
As a workaround I had to perform a manual conversion like this:
db.collection.find().forEach(function (p) {
db.collection.update({_id: p._id}, {
$set: {
field: parseFloat(p.field)
}
});
});
There is no concept of a decimal in mongodb. Once you convert to a float, you could have rounding issues since a double / float is not exact.