DEV Community

Abdul Ghofur
Abdul Ghofur

Posted on

Prisma & MongoDB: server to be run as a replica set

Solution for: "Prisma needs to perform transactions, which requires your MongoDB server to be run as a replica set"

Problem

Service & controller sudah dibuat, seharusnya semua aman.
Namun ketika hit API, muncullah Prisma needs to perform transactions, which requires your MongoDB server to be run as a replica set.

Root cause

Error tersebut di atas hanya terjadi pada operasi create, update, dan delete,
karena Prisma perlu MongoDB berjalan sebagai replica set untuk menjalankan operasi-operasi tersebut.

Solution

Edit mongodb.conf

Pastikan /etc/mongod.conf mempunyai code di bawah

replication:
  replSetName: rs0
Enter fullscreen mode Exit fullscreen mode

Restart MongoDB

Restart mongod service setelah perubahan config

sudo systemctl restart mongod
Enter fullscreen mode Exit fullscreen mode

https://abdulghofurme.github.io/posts/prisma-mongodb-server-to-be-run-as-a-replica-set/

Top comments (0)

Image of Docusign

🛠 Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more