I'm having issue with running the docker compose file the build passes smoothly but there is no mongo image to connect to ( in case i try to use a local one ) i have added this line :
depends_on:
- mongo
mongo:
image: mongo:7.0.0-rc3
ports:
- "27017:27017"
2023-08-28 17:20:29 [nodemon] starting `node server.js`
2023-08-28 17:20:30 [Aug-28-2023 16:20:30 - info ] Swagger available at /docs /docs-json
2023-08-28 17:20:30 [Aug-28-2023 16:20:30 - info ] App running on http://localhost:8000
2023-08-28 17:20:41 [Aug-28-2023 16:20:41 - error ] MongooseError: Operation `users.findOne()` buffering timed out after 10000ms
2023-08-28 17:20:41 at Timeout.<anonymous> (/app/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:175:23)
2023-08-28 17:20:41 at listOnTimeout (node:internal/timers:569:17)
2023-08-28 17:20:41 at process.processTimers (node:internal/timers:512:7)
2023-08-28 17:21:00 [Aug-28-2023 16:21:00 - error ] DB Connection Disconnected!
2023-08-28 17:21:00 [Aug-28-2023 16:21:00 - error ] DB Connection Failed!
2023-08-28 17:21:00 Exception : MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
2023-08-28 17:21:00 MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
2023-08-28 17:21:00 at Connection.openUri (/app/node_modules/mongoose/lib/connection.js:825:32)
2023-08-28 17:21:00 at /app/node_modules/mongoose/lib/index.js:414:10
2023-08-28 17:21:00 at /app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
2023-08-28 17:21:00 at new Promise (<anonymous>)
2023-08-28 17:21:00 at promiseOrCallback (/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
2023-08-28 17:21:00 at Mongoose._promiseOrCallback (/app/node_modules/mongoose/lib/index.js:1288:10)
2023-08-28 17:21:00 at Mongoose.connect (/app/node_modules/mongoose/lib/index.js:413:20)
2023-08-28 17:21:00 at Object.<anonymous> (/app/server.js:19:6)
2023-08-28 17:21:00 at Module._compile (node:internal/modules/cjs/loader:1256:14)
2023-08-28 17:21:00 at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)