2

I am new to mongodb. I have db url, and I want to connect to that server from my ubuntu terminal and access data on terminal. can anyone please help me how to connect?

Amir
  • 92
  • 1
  • 7
  • Does this answer your question? [SSH tunnle to mongodb using mongodb connection string](https://stackoverflow.com/questions/69558391/ssh-tunnle-to-mongodb-using-mongodb-connection-string) – ray Feb 09 '22 at 18:30

2 Answers2

9

Assuming you have the URI and the mongo shell installed, you can connect using the following command:

mongo <uri>

For example, if you want to log in as admin with the password mypassword through example.com on the port 27017, you can do:

mongo mongodb://admin:mypassword@example.com:27017/?authSource=admin

See: how can I connect to a remote mongo server from Mac OS terminal

0

If mongodb version is 5.x.x mongosh --host ip

andrei
  • 1
  • 2