Reputation: 4171
Each time I connect to a remote mongodb server, it is needed to write the host address of the mongo server.
In my situation, I connect only a single remote mongo. So, is there a way to set the default server address that make it possible to connect without passing host parameter each time?
Upvotes: 5
Views: 2084
Reputation: 4171
For the php driver, I can change the directive 'mongo.default_host = localhost' to 'mogno.default_host = REMOTEADDRESS'. By this change I no longer need to pass the host address. This is what I was looking for.
Upvotes: 2
Reputation: 9077
If you are on a *nix os you can use alias
(http://en.wikipedia.org/wiki/Alias_(command)):
alias mongo='mongo --host 127.0.0.1'
You might want to call you alias something else than mongo
though.
Upvotes: 3