Why MYSQL is giving Double data type value as string in NodeJs?

I am trying to get a double data type value from Mysql in Nodejs, but that value is coming as String javascipt data type.

I have millions of rows and I want those data to come as javascipt number type

// I am using this package
// const mysql = require("mysql2");

router.get("/prices/:symbol", (req, res) => {
    const q = `SELECT time, price
                FROM price_table
                WHERE symbol='${req.params.symbol}'
                LIMIT 1`
    connection.query(q, (error, rows) => {
        if (error) {
        } else {
            // Mysql INT data type - time is in UNIX TimeStamp
            console.log(typeof rows[0].time)            // console.log showing "number"
            // Mysql Double data type
            console.log(typeof rows[0].price)           // console.log showing "string"



According to the documentation string is the default for decimals. The why is probably that you could loose precision when converting to a js float.

You could try the decimalNumbers=true option?

const connection = mysql.createConnection({
    // Other configuration files

    decimalNumbers: true,