"If" does not update my collection

Alternatively, you can move the code to a beforeInsert hook in the backend data.js file.