From a48449dd4dc92f6d35ab84ed6b270ce3b3d7c704 Mon Sep 17 00:00:00 2001 From: Anukriti Srivastava Date: Wed, 25 Mar 2026 15:51:40 +0530 Subject: [PATCH 1/3] docs: add MongoDB replica set setup guide --- src/content/docs/mongodb-replica-setup.mdx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/content/docs/mongodb-replica-setup.mdx diff --git a/src/content/docs/mongodb-replica-setup.mdx b/src/content/docs/mongodb-replica-setup.mdx new file mode 100644 index 00000000..5e95a35b --- /dev/null +++ b/src/content/docs/mongodb-replica-setup.mdx @@ -0,0 +1,19 @@ +--- +title: MongoDB Replica Set Setup for Local Development +description: How to configure MongoDB as a replica set for local freeCodeCamp development. +--- + +## Why this is needed + +freeCodeCamp uses Prisma with MongoDB, and some database operations require transaction support. + +MongoDB transactions require the server to run as a replica set, even in local development. + +If MongoDB is started without replica set mode, contributors may encounter transaction-related runtime errors while running the app locally. + +## Start MongoDB with replica set enabled + +Run MongoDB with: + +```bash +mongod --replSet rs0 --dbpath ~/data/db \ No newline at end of file From dd657a5350a88474adff7ac01f6d01b08d242997 Mon Sep 17 00:00:00 2001 From: Anukriti Srivastava Date: Sat, 28 Mar 2026 12:28:24 +0530 Subject: [PATCH 2/3] docs: fix MongoDB replica setu steps --- src/content/docs/mongodb-replica-setup.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/docs/mongodb-replica-setup.mdx b/src/content/docs/mongodb-replica-setup.mdx index 5e95a35b..d8334fd3 100644 --- a/src/content/docs/mongodb-replica-setup.mdx +++ b/src/content/docs/mongodb-replica-setup.mdx @@ -1,3 +1,4 @@ + --- title: MongoDB Replica Set Setup for Local Development description: How to configure MongoDB as a replica set for local freeCodeCamp development. From 89a299272a5303535b78946600fc96dbb11e36ea Mon Sep 17 00:00:00 2001 From: Anukriti Srivastava Date: Sat, 28 Mar 2026 12:54:17 +0530 Subject: [PATCH 3/3] docs: clarify MongoDB replica set setup in local setup guide --- .../how-to-setup-freecodecamp-locally.mdx | 9 ++++++--- src/content/docs/mongodb-replica-setup.mdx | 20 ------------------- 2 files changed, 6 insertions(+), 23 deletions(-) delete mode 100644 src/content/docs/mongodb-replica-setup.mdx diff --git a/src/content/docs/how-to-setup-freecodecamp-locally.mdx b/src/content/docs/how-to-setup-freecodecamp-locally.mdx index e2aeb394..4ab5ea56 100644 --- a/src/content/docs/how-to-setup-freecodecamp-locally.mdx +++ b/src/content/docs/how-to-setup-freecodecamp-locally.mdx @@ -328,17 +328,20 @@ pnpm install ### Step 3: Start MongoDB and Seed the Database -Before you can run the application locally, you will need to start a MongoDB Server as a replica set. +Before you can run the application locally, you will need to start a MongoDB server as a replica set. + +freeCodeCamp uses Prisma with MongoDB, and some database operations require transaction support. MongoDB transactions require the server to run as a replica set, even in local development. -1. Stop any existing MongoDB server that uses port 27017 (if you already have a replica set running on that port, you can skip this and the next step) +1. Stop any existing MongoDB server that uses port `27017`. + + If you already have a MongoDB server running without replica set mode, you may encounter errors when trying to initialize or use the database for local development. 1. Start the MongoDB server as a replica set: ```bash docker compose -f docker/docker-compose.yml up -d - ``` 1. Seed the database and setup a new user: diff --git a/src/content/docs/mongodb-replica-setup.mdx b/src/content/docs/mongodb-replica-setup.mdx deleted file mode 100644 index d8334fd3..00000000 --- a/src/content/docs/mongodb-replica-setup.mdx +++ /dev/null @@ -1,20 +0,0 @@ - ---- -title: MongoDB Replica Set Setup for Local Development -description: How to configure MongoDB as a replica set for local freeCodeCamp development. ---- - -## Why this is needed - -freeCodeCamp uses Prisma with MongoDB, and some database operations require transaction support. - -MongoDB transactions require the server to run as a replica set, even in local development. - -If MongoDB is started without replica set mode, contributors may encounter transaction-related runtime errors while running the app locally. - -## Start MongoDB with replica set enabled - -Run MongoDB with: - -```bash -mongod --replSet rs0 --dbpath ~/data/db \ No newline at end of file