I struggled here for many hours but still stuck. I am trying to set up a MongoDB Docker container to use as a local database and using MongoDb Compass to connect. Here my docker-compose file
mongodb:
container_name: ms_mongo_db
image: mongo
ports:
- 27017:27017
volumes:
- mongo:/data
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=password
When my container run success, Im try to connect with this url : mongodb://root:password@localhost:27017/?authSource=admin
but MongoDbCompass keep saying authentication failed, although my username and password are correct. I have ready many problem orthers but still dont fix my issue. Can anyone know the problems is it? Thank for reading my problem. Silly me if there is any mistake