How to get update server id after onInsert?
In onInsert I'm calling my TRPC endpoint which return the server generate Public ID of the newly inserted item.
How can I access that data where I called Collection.insert?


4 Replies
rare-sapphire•4mo ago
hmm good question — the transaction itself would be the logical place to put this information as it's what connects the two call sites. But it doesn't have a way to put response data on it atm
we should add something for this
conventional-tanOP•4mo ago
Yeah I thought the same thing 😄 Should I file an issue?
rare-sapphire•4mo ago
yes please 😄
conventional-tanOP•4mo ago
GitHub
Adding server-generated properties to transaction in Collection.onI...
In my onInsert handler, I call a TRPC endpoint which returns the server-generated publicId of the newly created document: onInsert: async ({ transaction }) => { const newDocument = transaction.m...