How to update item in Dynamic Zone?

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.

The ID returned here is the ID of the table in the database.
I am unsure with your use case why you’d need to update the ID here to be your field value.
Since you’re populating deep you have access to that field on the response anyway?

If you could provide context around the “why” I might be able to advise futher.