I have the following data in MySQL database:
Column: Volume
Value:
3495303.0
3495123.8
3484616.8
3482624.8
3474865.5
3434217.5
3407878.0
I use the following code to read from the database:
let query = {
where: {
id: id
},
order: [
['time', 'DESC']
],
}
let result = await markets.findAll(query);
At the following is markets.js
let markets = dbConnection.connection.define(
'markets', {
...,
volume: Sequelize.FLOAT,
...,
}, {
timestamps: false
}
);
module.exports = markets;
However, when column "volume" is read from the database, all the number is converted into int rather than float. I manually executed SQL script generated by Sequelize, and I can see the value of volume has decimals.
However, when the data is loaded into my JSON object "result", the value for volume becomes integer.
I have tried with changing the definition in markets.js from
volume: Sequelize.FLOAT,
to
volume: Sequelize.DOUBLE,
But it does not change a thing. The definition of volume in MySQL is:
volume float