The connection method for MongoDB replica set instances (v4.0) is different from that of other versions. 3 IPs are provided on v4.0 for access, corresponding to 3 nodes in a replica set. When connecting your business in a production environment, you are recommended to configure 3 IPs in the connection string to make the connection more secure and efficient.
Note:
If only the IP of the master node is configured in the connection string, your business may face a read-only connection risk when a master/slave switchover occurs in the instance.
mongodb://mongouser:******@192.168.x.xx:27017,192.168.x.xx:27017,192.168.x.xx:27017/admin?authSource=admin&replicaSet=cmgo-7oiab5db_0
Was this page helpful?