Jvwer
PPrisma
•Created by Jvwer on 11/19/2024 in #help-and-questions
FindUnique/Update using unique index on sub field
Hi, I need some help with generating a schema where I can query indexed sub fields.
I've looked for solutions but I couldn't really find a thread matching my problem.
Let me sketch an example.
(I'm working with Prisma ORM with MongoDB)
This schema will generate fine and put an index on _id and replies.id that works as intended (there can only be one reply on all existing comments with a specific id).
I would like to use this unique index when querying the comments model.
However there is no key/type for this to be passed as an argument for findUnique or update.
the closest filter with the same result is this:
However this only works on ###Many operations.
How can I add this 'self-made' index available for unique filtering?
4 replies