Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect MongoDB docker by Studio 3T?

I am using docker image https://hub.docker.com/_/mongo/ (Latest MongoDB version)

I run command

docker run --name some-mongo -d mongo

Then I install Studio 3T I enter connection information like this

enter image description here

but I can't connect. What is correct connection must declare in Studio 3T in this case? How to connect MongoDB instance (docker) by Studio 3T?

like image 323
Do Nhu Vy Avatar asked Jan 29 '23 10:01

Do Nhu Vy


2 Answers

You need to export the port you want to use in your docker command. e.g.

docker run -p 127.0.0.1:27017:27017 --name some-mongo -d mongo

This opens the port of the container on your host machine.

like image 98
Rick Rongen Avatar answered Jan 30 '23 23:01

Rick Rongen


  • Click New Connection

  • Enter the Connection name

  • Click on From URI

  • Enter the URI in the following format mongodb://{username}:{password}@{ip_address}:{port}/?authSource=admin

  • Click OK

  • Click Test Connection

  • Works?

    • No: Check your username, password, etc
    • yes: Congrats!
like image 38
Lone Ronin Avatar answered Jan 30 '23 23:01

Lone Ronin