Downgrade MongoDB replica set to a standalone node

Remove secondary member nodes

Firstable, Shut down the mongod instance for the member you wish to remove.

rs.remove("127.0.0.1:27027")
rs.remove("127.0.0.1:27037")

Remove replication setting

Delete or comment replication setting in mongod.cfg file

#replication:
#replSetName: rs0
mongod --port 27017 --dbpath="C:\data\db0"
use localdb.system.replset.remove({})
db.replset.election.drop()db.replset.minvalid.drop()

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store