Optimizing Queries with Nested Mutations in Prisma
00:00 So we talked about nested queries a little bit. We've got these images that we're creating. At the same time, we're creating this note. So what's cool about this is it allows us to automatically handle foreign keys, like we're having to handle this foreign key right here.
00:15 We've got Kodi.id, and we're specifying that owner ID. But these images on the note, they rely on the note ID. But we're not actually having to specify that, because we don't even have it yet, we're in the process of creating it. But Prisma takes care of that for us. It also takes care of optimizing the query
00:34 so that it will be as efficient as we need it to be. So what I want you to do is to take this to the next level. Let's turn it up to nine and nest the note create inside of the user create. I actually like nesting these queries as deep as possible, but I know not everybody is on board with that.
00:53 So go ahead and just try it, and if you don't like it, then that's fine. I'm not your mom. You do what you want, and you can go ahead and create multiple queries if you want in your own code base. But here, I want you to try nesting it. So go ahead and nest this one, and we'll see you when you're done.