By default Compose sets up a single network for your app. Each
container for a service joins the default network and is both
reachable by other containers on that network, and discoverable by
them at a hostname identical to the container name.
According to your docker-compose.yaml
file you can access you mongo container on 127.0.0.1:27017
only from host machine.
In order to access it from NodeJS backend container you should use db:27017
.
Related Contents:
- Docker-compose: node_modules not present in a volume after npm install succeeds
- How do I manage MongoDB connections in a Node.js web application?
- Push items into mongo array via mongoose
- E11000 duplicate key error index in mongodb mongoose
- Stop Mongoose from creating _id property for sub-document array items
- $lookup multiple levels without $unwind?
- Avoid “current URL string parser is deprecated” warning by setting useNewUrlParser to true
- Why does mongoose always add an s to the end of my collection name
- Mongoose, update values in array of objects
- Cannot overwrite model once compiled Mongoose
- mongoError: Topology was destroyed
- Why is it recommended not to close a MongoDB connection anywhere in Node.js code?
- MongoDB/Mongoose querying at a specific date?
- ECONNREFUSED for Postgres on nodeJS with dockers
- How to create a DB for MongoDB container on start up?
- MongoDB – get documents with max attribute per group in a collection
- Can mongo upsert array data?
- Model.find().toArray() claiming to not have .toArray() method
- Mongoose Unique values in nested array of objects
- Mongoose Schema hasn’t been registered for model
- mongodb/mongoose findMany – find all documents with IDs listed in array
- MongoError: The ‘cursor’ option is required, except for aggregate with the explain argument
- How to populate a sub-document in mongoose after creating it?
- Mongoose findByIdAndUpdate not returning correct model
- Mongoose/mongoDB query joins.. but I come from a sql background
- mongoose custom validation using 2 fields
- add created_at and updated_at fields to mongoose schemas
- MongoError: connect ECONNREFUSED 127.0.0.1:27017
- MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]
- Why does `package-lock.json` causes a failure in a docker container build when `npm install`?
- Mongoose (mongodb) batch insert?
- How to protect the password field in Mongoose/MongoDB so it won’t return in a query when I populate collections?
- How can I use a cursor.forEach() in MongoDB using Node.js?
- MongoDB Node check if objectid is valid
- how to use populate and aggregate in same statement?
- Error: getaddrinfo ENOTFOUND in nodejs for get call
- Automatically remove referencing objects on deletion in MongoDB
- Mongoose, find, return specific properties
- remove _id from mongo result
- Fill missing dates in records
- How to fix ‘Error: querySrv EREFUSED’ when connecting to MongoDB Atlas?
- How to fix ‘Error: querySrv EREFUSED’ when connecting to MongoDB Atlas?
- How to drop a database with Mongoose?
- Mongoose update without callback
- Difference between MongoDB and Mongoose
- What is best way to handle global connection of Mongodb in NodeJs
- Meteor Subscribe doesn’t update sort order of collection
- How can I generate an ObjectId with mongoose?
- How do I get the objectID after I save an object in Mongoose?
- Mongoose password hashing