The problem occurs when i connect to mongodb with error is authentication failed.
This’s my command: mongosh --port 27017 -u admin -p pwdadmin
I’m confusing that i use volume in docker-compose so the configuration of /data/db is configured.
aasawari.sahasrabuddhe@M-C02DV42LML85 ~ % docker exec -it 406ebdb0b484 bash
root@406ebdb0b484:/# mongosh -u admin -p password
Current Mongosh Log ID: 65671095371b0192f0100d5c
Connecting to: mongodb://<credentials>@127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.1.0
Using MongoDB: 7.0.4
Using Mongosh: 2.1.0
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
------
The server generated these startup warnings when booting
2023-11-29T10:14:13.759+00:00: vm.max_map_count is too low
------
test>
You can try using the above docker file and confirm if you are successfully able to make the connection.
Based on the above credentials, can you confirm the source from the where are values are being picked up in the docker compose file?
Can you confirm if you are using the above command to connect inside the docker container?
Hello! i’m needing execute docker compose to use it with nestjs but when i try logging add user and password defined on my docker compose and I try to make a request it tells me that I do not have permissions , just may resolved add to user to container console db.createUser … Is there a way to make this automatic, I thought that by adding MONGO_INITDB_ROOT_USERNAME this user could do everything but that is not the case.