How to connect to remote Mongodb from Linux terminal
We can use mongo command to connect to remote Mongodb instances.
If the mongodb is not using authentication, we can use the following command.
#mongo --host mongohost --port 28015
Here the mongohost should be replaced by the hostname or ipaddress of the mongodb server.
If the mongodb is using authentication, we can user the following command.
#mongo --username mongouser --password --authenticationDatabase admin --host mongohost --port 28015
Here mongohost and mongouser should be replaced by the corresponding values. This command will ask for the mongouser password during the execution.
That's all…