I am using mongodb 7.0.4 in parrotos.
I am using this code to create replica set
rs.initiate({
_id: "rs1",
members: [
{_id: 0, host: "localhost:27018"},
{_id: 1, host: "localhost:27019"},
{_id: 2, host: "localhost:27020"}
]
});
but it is giving me error
MongoServerError: This node was not started with replication enabled.
at Connection.onMessage (/usr/lib/mongodb-compass/resources/app.asar.unpacked/node_modules/@mongosh/node-runtime-worker-thread/dist/worker-runtime.js:2:840034)
at MessageStream.<anonymous> (/usr/lib/mongodb-compass/resources/app.asar.unpacked/node_modules/@mongosh/node-runtime-worker-thread/dist/worker-runtime.js:2:837920)
at MessageStream.emit (node:events:513:28)
at p (/usr/lib/mongodb-compass/resources/app.asar.unpacked/node_modules/@mongosh/node-runtime-worker-thread/dist/worker-runtime.js:2:863891)
at MessageStream._write (/usr/lib/mongodb-compass/resources/app.asar.unpacked/node_modules/@mongosh/node-runtime-worker-thread/dist/worker-runtime.js:2:862512)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at Socket.ondata (node:internal/streams/readable:766:22)
at Socket.emit (node:events:513:28)
what should I do?