MongoDB database connection error

I am also trying different network connections it returns the same error. Please help I am stuck last 15 days in this error. Oh! last one thing my laptop IP is dynamically changing so what can I do know.

server is running on port number 8003

TopologyDescription {
  type: 'ReplicaSetNoPrimary',
  servers: Map(3) {
    'cluster0-shard-00-00.pte5t.mongodb.net:27017' => ServerDescription {
      _hostAddress: new HostAddress('cluster0-shard-00-00.pte5t.mongodb.net:27017'),
      address: 'cluster0-shard-00-00.pte5t.mongodb.net:27017',
      type: 'Unknown',
      hosts: [],
      passives: [],
      arbiters: [],
      tags: {},
      minWireVersion: 0,
      maxWireVersion: 0,
      roundTripTime: -1,
      lastUpdateTime: 206991185,
      lastWriteDate: 0,
      error: MongoNetworkError: connect EACCES 13.127.62.75:27017
          at connectionFailureError (I:\MERN Big Project\projects\mern-crud\server\node_modules\mongodb\lib\cmap\connect.js:381:20)
          at TLSSocket.<anonymous> (I:\MERN Big Project\projects\mern-crud\server\node_modules\mongodb\lib\cmap\connect.js:301:22)
          at Object.onceWrapper (events.js:520:26)
          at TLSSocket.emit (events.js:400:28)
          at emitErrorNT (internal/streams/destroy.js:106:8)
          at emitErrorCloseNT (internal/streams/destroy.js:74:3)
          at processTicksAndRejections (internal/process/task_queues.js:82:21)
    },
    'cluster0-shard-00-01.pte5t.mongodb.net:27017' => ServerDescription {
      _hostAddress: new HostAddress('cluster0-shard-00-01.pte5t.mongodb.net:27017'),
      address: 'cluster0-shard-00-01.pte5t.mongodb.net:27017',
      type: 'Unknown',
      hosts: [],
      passives: [],
      arbiters: [],
      tags: {},
      minWireVersion: 0,
      maxWireVersion: 0,
      roundTripTime: -1,
      lastUpdateTime: 206991184,
      lastWriteDate: 0,
      error: MongoNetworkError: connect EACCES 13.235.150.74:27017
          at connectionFailureError (I:\MERN Big Project\projects\mern-crud\server\node_modules\mongodb\lib\cmap\connect.js:381:20)
          at TLSSocket.<anonymous> (I:\MERN Big Project\projects\mern-crud\server\node_modules\mongodb\lib\cmap\connect.js:301:22)
          at Object.onceWrapper (events.js:520:26)
          at TLSSocket.emit (events.js:400:28)
          at emitErrorNT (internal/streams/destroy.js:106:8)
          at emitErrorCloseNT (internal/streams/destroy.js:74:3)
          at processTicksAndRejections (internal/process/task_queues.js:82:21)
    },
    'cluster0-shard-00-02.pte5t.mongodb.net:27017' => ServerDescription {
      _hostAddress: new HostAddress('cluster0-shard-00-02.pte5t.mongodb.net:27017'),
      address: 'cluster0-shard-00-02.pte5t.mongodb.net:27017',
      type: 'Unknown',
      hosts: [],
      passives: [],
      arbiters: [],
      tags: {},
      minWireVersion: 0,
      maxWireVersion: 0,
      roundTripTime: -1,
      lastUpdateTime: 206991308,
      lastWriteDate: 0,
      error: MongoNetworkError: connect EACCES 13.233.171.60:27017
          at connectionFailureError (I:\MERN Big Project\projects\mern-crud\server\node_modules\mongodb\lib\cmap\connect.js:381:20)
          at TLSSocket.<anonymous> (I:\MERN Big Project\projects\mern-crud\server\node_modules\mongodb\lib\cmap\connect.js:301:22)
          at Object.onceWrapper (events.js:520:26)
          at TLSSocket.emit (events.js:400:28)
          at emitErrorNT (internal/streams/destroy.js:106:8)
          at emitErrorCloseNT (internal/streams/destroy.js:74:3)
          at processTicksAndRejections (internal/process/task_queues.js:82:21)
    }
  },
  stale: false,
  compatible: true,
  heartbeatFrequencyMS: 10000,
  localThresholdMS: 15,
  setName: 'atlas-2b1p0u-shard-0',
  logicalSessionTimeoutMinutes: undefined
}



1 Like

@Md_Shihab hi there,

Edited your tags so the right people see the post. Seems you are trying to connect to an atlas replica set.

Sorry to hear that. I am not an experienced user, but the error seems to be that the replica set isn’t able to elect a primary node (normally the want drivers will connect to).

Member Node Elections’ are triggered in different situations, and should be resolved into a new primary, but seems not to be the case here.

Just to see if you get any extra or cleaner output, I’d try to connect with the mongo shell (mongo MONGO_URI) if you have the mongo binary installed.

If my diagnosis is correct, but please wait for proper MDB employees, you may contact the Support Team, and read through this link (short article).


For Dynamic Public IP

Get into the MongoDB Atlas website (if you have access to) and open the networks access to any IP (just type 0.0.0.0/0), this allows access from anywhere. So you will access from any coffee shop.

For Dynamic Private IP only
If your PC uses DHCP locally, that doesn’t really matter. As long as you are in the same network, your public IP is the same.

1 Like

#Solved
Thanks, @santimir for your suggestion. So finally, I got the error reason and this error mainly occurs for my windows 10 OS security reason because windows defender doesn’t allow private/public network IP for my node.js software. Then I apply this below in a screenshot.

2 Likes

Good find @Md_Shihab, you should mark it as solution.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.