Sergy Sergy - 11 months ago 70
MySQL Question

How to get rows with a bit typed fields from mysql in node.js?

I am using a mysql npm package for connection and trying to get data from table, which has columns with type BIT.
But these columns have gone as:

"isBasic": {
"type": "Buffer",
"data": [

How can I map them to boolean type?

Answer Source

The bit data type is not perfectly used in mysql package. We usually use tinyint in tables to store 0 and 1 and then just do the comparison in Javscript to determine true or false.