Nodejs mongoose connection copy set configuration

topic description

the following is a set of built replicas, where 12 nodes are arbitration nodes
192.168.1.10 br 27017
192.168.1.11 purl 27017
192.168.1.12 purl 27017

replica set set is: sss

nodejs uses mongoose middleware to connect to mongodb
has a global admin library account root:testadmin
ask how to configure mongoose"s uri and options

sources of topics and their own ideas

try to configure mongodb://root:testadmin@192.168.1.10:27017192.168.1.11:27017/test?authSouce=admin&replicaSet=sss by yourself

will report an error soket hang up

how to correctly configure the URI of the replica set?

Sep.27,2021

mongodb://root:testadmin@192.168.1.10:27017192.168.1.11:27017192.168.1.12:27017/test?authSouce=admin&replicaSet=sss
PS: A maximum of one arbitration occurs in a cluster, and two arbitrations are unnecessary.

Menu