Skip to content

Views count not updating in Next.js with Prisma #21307

Closed Answered by MortezaIsvand
MortezaIsvand asked this question in Q&A
Discussion options

You must be logged in to vote

I solved the problem with the views functionality. The problem occurred because I had created some posts before I defined the views field in the prisma.schema.ts file. As a result, these posts did not have the views field in the MongoDB Atlas database. To fix this, I used Prisma Studio to assign random views counts to each post manually. After that, all posts had the views count working properly.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@MortezaIsvand
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by MortezaIsvand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants