Could not connect to database using connectionString


I have the line below in my docker-compose.yml


This gives me the error below.

 Could not connect to database using connectionString: mongodb://user1:****,,"
                 const timeoutError = new error_1.MongoServerSelectionError(`Server selection timed out after ${serverSelectionTimeoutMS} ms`, this.description);

 MongoServerSelectionError: getaddrinfo EAI_AGAIN server1

The line below works when I specify it in my docker-compose.yml. However, this will not work if this server is being serviced. I would like to take advantage of the replicaSet.


I connect successfully using the command below.

mongosh "mongodb://${UNAME}:${PASSWORDD},,"

Help. I have tried different ways to specify ME_CONFIG_MONGODB_URL.

mongo-express version is 1.0.2-20.

Please provide the results of rs.status()

Here is the result of rs.status().

Try to change your config so that the member

      _id: 0,
      name: 'server1:27001',

is specified as

    _id: 0,
      name: '',

Thank you @steevej

That fixed the issue. :smile:

1 Like

Please mark my post as the solution.

Thank you