curious how would one go about performing a `conne...
# orm-help
m
curious how would one go about performing a
connectOrCreate
on an array? similar to this, but instead creating the record if it doesn't exist
Copy code
data: {
    email: '<mailto:vlad@prisma.io|vlad@prisma.io>',
    posts: {
      connect: [{ id: 8 }, { id: 9 }, { id: 10 }],
    },
  },
s
You do it like so:
Copy code
where: { email: '<mailto:alice@prisma.io|alice@prisma.io>' },
  data: {
    posts: {
      connectOrCreate: [
        {
          where: { id: 32 },
          create: { title: 'This is my first post' },
        },
        {
          where: { id: 19 },
          create: { title: 'This is my second post' },
        },
      ],
    },
  },
✅ 2
m
Thanks!