Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON incompatibility with node-mysql #2181

Closed
PRR24 opened this issue Aug 19, 2023 · 4 comments
Closed

JSON incompatibility with node-mysql #2181

PRR24 opened this issue Aug 19, 2023 · 4 comments

Comments

@PRR24
Copy link

PRR24 commented Aug 19, 2023

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.

@sidorares
Copy link
Owner

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

@fenying
Copy link

fenying commented Sep 9, 2023

Met the problem with TypeORM.😆

@sga-solita
Copy link

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)

@wellwelwel
Copy link
Collaborator

wellwelwel commented May 30, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants