Skip to content

Could not connect to database using connectionStringΒ #125

@jyanga

Description

@jyanga

Hi,

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

- ME_CONFIG_MONGODB_URL=mongodb://${UNAME}:${PASSWORDD}@server1.example.com:27001,server2.example.com:27002,server3.example.com:27003/?replicaSet=mongodb-rs1

This gives me the error below.

 Could not connect to database using connectionString: mongodb://user1:****@server1.example.com:27001,server2.example.com:27002,server3.example.com:27003/?replicaSet=mongodb-rs1"
 /app/node_modules/mongodb/lib/sdam/topology.js:285
                 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.

- ME_CONFIG_MONGODB_URL=mongodb://${RUNAME}:${RPASSWD}@server1.example.com:27001/?directConnection=true

I connect successfully using the command below.

mongosh "mongodb://${UNAME}:${PASSWORDD}@server1.example.com:27001,server2.example.com:27002,server3.example.com:27003/?replicaSet=mongodb-rs1"

Help. I have tried different ways to specify ME_CONFIG_MONGODB_URL.

mongo-express version is 1.0.2-20.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions