About json data type handling of mysql

recently, app is going to do a feature similar to giving likes by Qzone. When you go to the database, you can use the new data type json after mysql 5.7 to store the like user id, so that every time a user gives a like, you can use json_merge to add an id to the field. There"s nothing wrong with adding it. The data format is as follows:

praiseList is the id list of users who like it. However, it is dumbfounded to delete data. The official json_remove method can only be deleted according to the key of json or the subscript of the array, not directly through the values in the array. I have been perplexed by this problem for a long time. I would like to ask you humbly how to deal with it.

Feb.08,2022

has not used the json type, after all, it still treats MySQL as a relational database. In this case, you can take out the content in the program, delete the value and then update it back. However, it is necessary to control concurrent access.


consider building a mongodb, to store hot data at the front end. Wait for the data to cool down, and then flow back to mysql.

Menu