System Information
- Strapi Version: 4.1.1
- Operating System: Ubuntu 20.04
- Database: MySQL
Hello everyone, i have a collection type item like this. I want to update Settings
item with the key is IG_ACCESS_TOKEN
. How to update it?
I tried this code at Services like this and failed.
const entity = await strapi
.service("api::configuration.configuration")
.find({
filters: {
Key: {
$in: "_app",
},
},
populate: {
Settings: {
populate: "*",
},
},
});
const newSettings = [...]; // DO SOMETHING
const newEntity = utils.parseJSON(JSON.stringify(entity));
newEntity.results[0].Settings = newSettings;
await strapi.db.query("api::configuration.configuration").update(
{
id: entity.results[0].id,
},
{
...entity.results[0],
Settings: newSettings,
}
)
I don’t know what is the keywords or links related to this issue. Thank you.