Answer the question
In order to leave comments, you need to log in
Why does a MongooseServerSelectionError occur when connecting to a local mongodb database?
Error when connecting to local mongodb database mongodb://localhost:27017/?replicaSet=rs0/ users
Mongoose default connection has occured MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/ error
Готов задонатить за ответ если поможет)
reason: TopologyDescription {
type: 'ReplicaSetNoPrimary',
setName: null,
maxSetVersion: null,
maxElectionId: null,
servers: Map(0) {},
stale: false,
compatible: true,
compatibilityError: null,
logicalSessionTimeoutMinutes: null,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
commonWireVersion: 9
}
}
Answer the question
In order to leave comments, you need to log in
everything turned out to be simple, it was necessary to add the name of the replica to the mongi config file:
replication:
replSetName: <string>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question