Creating a related record with Prisma returning all records / how to get just one?
Hi folks! I'm pretty new to prisma so i have something a little annoying happening, love your guidance.
I'm running some reporting - one batch has many reports... so first i create the batch
Then i create a report:
The first time this runs, the report is returned like this:
which is a little annoying cause i just need the report to come back, but in a situation where there are 10000 reports, the last one would return with
report.length
of 10000
Which is annoying, and not performant (too much data getting passed around), and also hard to know which item i created (use Array.pop
?)
Is there a way to do it the other way? to create the the report, and have that report created as a relation in one go? ive found connect
operator but it looks like it can only be used if i create the report first? so you have to do it in two queries?1 Reply
worked!