is it possible to reference something created in t...
# orm-help
c
is it possible to reference something created in the same mutation? i.e.:
Copy code
db.updateUser({
    where {
    userid:'123'
    }
    data: {
        posts: {
            create: {
                name:'my new post'
            }
        },
        actions: {
            create:{
                actionType: 'posted',
                post: {
                    // somehow connect the above created post?
                }
            } 
        }
    }
});
h
No, you need to make separate calls but prisma client batches things internally so this will result in one db call in the end
c
@Harshit thank you!
I don't actually see how its possible now that I think about it, for it to batch it internally
because I need to
await
the response of the first one in my code, to get the id...
so I can
connect:
the id of the new post to the action
so I don't think there is any way prisma can internally batch it if its not part of the same query... are you sure?
I figured out how to do it as part of a single query though
basically put the create for posts down in the create of the action
h
Great :)
We use batching using dataloader but in this case yes it will make two calls, by bad lol