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?
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
If mongodb version is 5.x.x
mongosh --host ip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With