This looks like it might work, but I'm not sure ab...
# orm-help
a
This looks like it might work, but I'm not sure about the efficency of it. Is this sound? Can it be improved on?
Copy code
await prisma.section.findMany({
      where: {
        OR: identifiers.map(({ resourceId, index }) => ({
          resourceId,
          index
        }))
      }
    })
1
n
Hey Adrien 👋 So if I understand correctly your compound id is a combination of
resourceId
and
index
, correct? Based on this the query which you have shared looks good.
Let me know if you are still running into this.
a
Yeah it's a combo of
resourceId
and
index
. Looks like it works 🙂 just wondering if there's a "better" way of doing it
would b nice to have an interface similar to normal unique columns where you can go
findMany({ where: { id: { in: ['id1', 'id2'] } } })
e.g. if I could do
Copy code
findMany({
  where: {
    resourceId_index: {
      in: identifiers
    }
  }
})
n
I can see how this would make the DX better here, I’ll share this feedback with the team. Thanks for bringing this up 🙌
❤️ 1