Nodejs connection mongodb cluster error MongoError: no primary found in replicaset

A cluster configured with MongoDB sharding, such as the address https://www.cnblogs.com/ityou.

use the mongoose module to connect to the database. The code is as follows: mongoose.createConnection ("mongodb://name:pwd@xxx:20000,xxx:20000,xxx:20000/db", {useMongoClient: true})

running the project Times error: "MongoError: no primary found in replicaset", what is the cause of that? Is it the problem of MongoDB cluster fragmentation, or is the connection not in the right way?
error message:

clipboard.png

db.status():

clipboard.png

shard1rs.status()

clipboard.png

clipboard.png

shard2rs.status()

clipboard.png

clipboard.png
shard3rs.status()

clipboard.png

clipboard.png

Apr.02,2021

go in with the command line, and sh.status () take a look at the output.

Menu