Does anyone know how to do a mongodb unordered ins...
# orm-help
k
Does anyone know how to do a mongodb unordered insert using the prisma client. ( i want to insertMany and skip/ignore any duplicate errors )
1
👀 1
a
Hey Kay 👋🏾 You might be looking for the
createMany
operation – API reference. You can pass the
skipDuplicates
parameter to skip duplicate records. 🙂
k
@Alex Ruheni mongo does not support on conflict do nothing
a
Ah, TIL 🙂 One workaround would be to use
upsert
method, update a record if it exists, create one if it exists, and wrap the query in a for loop.
Hey Kay, 👋🏾 Have you had any luck solving your issue?
k
yes i eventually did
👍🏾 1