Sergy Sergy - 1 year ago 126
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download