Hi friends, i have a unique constraint on my model...
# prisma-client
k
Hi friends, i have a unique constraint on my model
Copy code
@@unique([address, date], name: "uniq_address_date")
I am using
createMany
to insert many documents. Is it possible that if any one of those documents doesent' satisfy the requirement, it moves onto the next? in other words i dont want it to fail, i want it to continue with the documents that its able to insert I'm using mongodb and this would normally but done my an unordered insert https://www.mongodb.com/docs/manual/reference/method/db.collection.insertMany/#unordered-inserts is something like this possible?
1
n
Hmm, that’s a good question!
Is it possible that if any one of those documents doesent’ satisfy the requirement, it moves onto the next?
I assume you have tried this and found that this doesn’t work? If no, it might be worth trying this out at least to check 🙂 If it indeed doesn’t work, I think it’s best to create a feature request to ask for this functionality. If this kind of query exists in MongoDB, we would want to also expose it via Prisma Client 🙌
k
I manage to solve this one already https://github.com/prisma/prisma/discussions/14192
💯 1