Strapi beforeupdate passed in only updated fields from query('...').update

hi,

i just found another bug or issue. if save my data from form, its not an issue. but if i need to update my model, and i only do partial update of few or 1 field, and

the callback beforeUpdate(id, data) will be called with only the data been passed in from strapi.query(‘model’).update({id: xxx}, { name: ‘xxx’});

iam expecting that the data should contains all data instead of only the updated fields.
did anyone face the same issue?

thank you

We only send the updated fields, while the HTTP request is a PUT method, in reality Strapi is using the PATCH style.

If you need the unchanged data I would recommend making a query to the database:

strapi.query('model').findOne({ id: xxx });

From there you can compare the changes to what currently exists in the database.

1 Like

@DMehaffy

Is this relevant for v4 and v5?