prisma transaction 1

prisma transaction

const [posts, totalPosts] = await prisma.$transaction([{ where: { title: { contains: 'prisma' } } }),,

Here is what the above code is Doing:
1. It starts a transaction
2. It executes the first query, which returns a list of posts
3. It executes the second query, which returns the total number of posts
4. It commits the transaction
5. It returns the results of the two queries

Similar Posts