node-mysql2
node-mysql2 copied to clipboard
JSON incompatibility with node-mysql
node-mysql2 returns deserialized value of MySQL JSON column while node-mysql returns string. For updating/inserting, both require serialized string. I think it is worth adding to "Known incompatibilities with node-mysql" section of the documentation.
I think it is worth adding to "Known incompatibilities with node-mysql" section of the documentation.
Yes, agree. There was also some discussion to allow to change this behaviour via some config flag
Met the problem with TypeORM.😆
I also encountered this problem while attempting to switch our library from mysql to mysql2. A configuration flag would make it possible to switch gradually (ie. change the library and then afterwards change logic to handle deserialized objects)
Closing due to #2642.
It's now possible to use this option at the connection level:
{
jsonStrings: true,
}
Also, the known incompatibilities section has been updated by @rubenmorim:
https://sidorares.github.io/node-mysql2/docs/documentation#known-incompatibilities-with-node-mysql