skip to Main Content

How to initiate mongodb replica set using nodejs

I'm running the following code for mongodb replica set initialization: try { const mongoClient: MongoClient = new MongoClient(process.env.MONGODB_URI || 'mongodb://mongodb:27017', {replicaSet: "rs0"}); const mongoDb: Db = new Db(mongoClient, "admin"); const response = await mongoDb.admin().command({ replSetInitiate: {} }, {}) } catch…

VIEW QUESTION
Back To Top
Search