Hi, I am running my nestjs backend with mongodb as a docker-compose:
version: '3.4'
services:
pfbackend:
image: backend
environment:
NODE_ENV: production
ports:
- 3000:3000
depends_on:
- mongo_db
mongo_db:
image: mongo:latest
environment:
MONGO_INITDB_ROOT_USERNAME: test
MONGO_INITDB_ROOT_PASSWORD: test
If I use this connection string:
MongooseModule.forRoot('mongodb://@mongo_db:27017/test'),
It connects just fine but can't do anything because it isn't authentified
command find requires authentication
But if I add the authentification in the connection string:
MongooseModule.forRoot('mongodb://test:test@mongo_db:27017/test'),
It gives me the classic Unable to connect to the database
So i'm in quite the pickle and I don't know what to try anymore, anyone know ?