Cannot connect to Mongodb atlas using puTTy

44 Views Asked by At

I tried using puTTy to run my NodeJs application. Despite having everything in place including the network access allowed for all IP addresses and firewall restrictions removed, I could not connect to my Mongodb server via Mongodb atlas. The error I get is this:

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://www.mongodb.com/docs/atlas/security-whitelist/
    at _handleConnectionErrors (/home/jhaeh0dc8zzm/public_html/node_modules/mongoose/lib/connection.js:805:11)
    at NativeConnection.openUri (/home/jhaeh0dc8zzm/public_html/node_modules/mongoose/lib/connection.js:780:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  reason: TopologyDescription {
    type: 'ReplicaSetNoPrimary',
    servers: Map(3) {
      'ac-gwqxups-shard-00-02.sog5xof.mongodb.net:27017' => [ServerDescription],
      'ac-gwqxups-shard-00-00.sog5xof.mongodb.net:27017' => [ServerDescription],
      'ac-gwqxups-shard-00-01.sog5xof.mongodb.net:27017' => [ServerDescription]
    },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: 'atlas-s75ch5-shard-0',
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined

I included 0.0.0.0/0 in my network access list of the database, and also have my application running fine in VS Code. Any solution to this issue would help highly.

0

There are 0 best solutions below