Skip to content

joyson04/Node_mongo_Hello-world

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongodb://: This protocol tells the client (Node.js, for example) to use MongoDB.

The handle the connection.

MongoDB connection string starts with mongodb:// or mongodb+srv:// for SRV records.

mongo: This is the hostname or service name of the MongoDB container.

In Docker Compose, services communicate over a custom network by their service names:

services: mongo: image: mongo: latest

Docker automatically sets up internal DNS resolution so that any container in the same network can access the MongoDB container using mongo.

You don't need to use localhost or an IP address when you're inside a Docker network:

ports:

  • "27017:27017"

This is the port that MongoDB is listening to.

Summary:

mongodb://: Specifies MongoDB as the protocol.

mongo: The hostname (or service name) of the MongoDB container in Docker.

:27017: The port on which MongoDB listens.

/Demo: The name of the MongoDB database you are connecting to

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published