Update to collections with dynamic zones and nested components

Hi Team
I have a collection with dynamic zone. In addition to it, the dynamic zone items have some repeatable components. I am reading data with
strapi.services.<collection>.find({})
and with some changes to data trying to save with
strapi.services.<collection>.update({id:id},data)
This gives entry.notFound error for repeatable components. some extract from error stack

Error: entry.notFound at Object.update (~/app/node_modules/strapi-connector-mongoose/lib/queries.js:433:19) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Object.update (~/app/node_modules/strapi-database/lib/queries/create-query.js:73:18)

1 Like

As mentioned on slack, let me try and do some digging. I’ll get back with you.

2 Likes

Hi is there any update on this question? I am facing the same issue with updating a document that has a repeatable component.
Using strapi 3.4.5

Thanks

UPDATE:
I have found a workaround for now.

// Update room in DB with new stream
      const stream = {
        users_permissions_user: userId,
        channel: uuidv4()
      }
      const room = await strapi.query('rooms').findOne({id:roomId})
      const streams = room.streams.map(s => ({
        ...s,
        _id: s._id.toString()
      }))
      streams.push(stream)

      room.streams = streams

      const updated = await strapi.query('rooms').update({id:roomId}, room)

The above code works. The issue existed before I mapped the streams and converted the existing streams _id to strings ( _id: s._id.toString()).
It seems strapi’s update query doesn’t handle objectId types for nested components.

Is this currently a bug, or is my approach to trying to find and update a document containing components not conventional?

Cheers