sh.addShard error

MongoDB Enterprise mongos> sh.addShard(“m103-repl/192.168.103.100:27012”)
{
“ok” : 0,
“errmsg” : “Could not find host matching read preference { mode: “primary” } for set m103-repl”,
“code” : 133,
“codeName” : “FailedToSatisfyReadPreference”,
“operationTime” : Timestamp(1564482413, 1),
“$clusterTime” : {
“clusterTime” : Timestamp(1564482413, 1),
“signature” : {
“hash” : BinData(0,“AAAAAAAAAAAAAAAAAAAAAAAAAAA=”),
“keyId” : NumberLong(0)
}
}
}

Hi @yatinpatel13983,

There can be a probable issue with your config file, can you please share you config file details?

Meanwhile, kindly take a look at the following post and see if it works for you.

Please let me know if the issue persists.

Thanks,
Muskan
Curriculum Support Engineer

hi Kanika, thanks for your update. No need to remove all. I found mistake. I was trying to add secondary replica set instead of primary. Now all working fine. I have one que: why am I not able to see all collections on config DB.

MongoDB Enterprise mongos> use config
switched to db config
MongoDB Enterprise mongos> show collections
changelog
chunks
collections
databases
lockpings
locks
migrations
mongos
shards
tags
transactions
version

HI @yatinpatel13983,

Great, you were able to resolve the issue!!!

The collections listed after show collection commands are the set of collections you are supposed to expect in the config database.
Please refer to the following doc for more details on config db collections:

Please let me know, if you have any questions.

Thanks,
Sonali