I want to append products(object) in the wishlist(Array) which is stored as JSON field in my JWT collection type. On updating with default update route strapi simply replaces the whole data with the new one. Is there a way to achieve this?
Every time you update a field it replaces the current value, that’s how updates works
If you want to achieve this functionality you have to take one or two extra steps
- Fetch all the data of row that you want to update.
- Take out
wishlist
property - Push / Merge your body data to fetched wishlist data
- Update the entry with new merged data
You have to write a custom controller or extend the default update
controller to achieve this functionality
thanks i did that. it is working now
Hi, how to update on this way on the user model?
i’d need the same guys, any updates how to do that??