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?
CodePudding user response:
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:[email protected]:27017/?authSource=admin
See: how can I connect to a remote mongo server from Mac OS terminal
CodePudding user response:
If mongodb version is 5.x.x
mongosh --host ip