Relation many record MySQL
How to create many record using forEach in array and relrelation it to parent table in MySQL like Prisma
await ctx.prisma.post.create({
data: {
content: input.content,
imageUrl: input.imageUrl,
authorId: userId,
hashtags: {
connectOrCreate: input.tags?.map((tag) => ({
where: { name: tag },
create: { name: tag },
})),
},
},
})