Data is not seen in the lifecycle hooks for the component inside a collection

in v4,

you can do something like this to manipulate your data records,

inside any lifecycle methode,

   const { connection } = strapi.db;
    const tableName = 'components_name';
    
    // Fetch all records from the table
    const records = await connection(tableName).select('*');
    // Iterate through each record and update the columns
    for (const record of records) {
      const info = JSON.parse(record.product);

      await connection(tableName)
        .where({ id: record.id })
        .update({
          column1: info.value,
          column2: info.id,
          column3: info.label,
        });
    }
    
    // Optionally, you can fetch and return the updated records
    const updatedRecords = await connection(tableName).select('*');
    
    // You can access the updated records in the updatedRecords variable
    console.log(updatedRecords);