Pergunta

I ampretty new to Mongo shell and I am trying to switch the server using shell. My current server is of course localhost. I am trying to connect to someserver and the command that I am using for this is basically

mongodb://someserver

I also tries

mongodb://someserver:27017

in both cases my command is followed by ... and then it does nothing. I am still on localhost.

Please note that there are no credential required on someserver.

Foi útil?

Solução

You can't directly switch to a different connection from the mongo shell prompt. You can open additional connections though as:

var somedb = connect('someserver/somedb');

To start over with a new mongo server, at the command shell prompt:

mongo someserver/somedb

Outras dicas

Can you telnet to that host and port combo? When I have problems, that's the first thing I do to make sure I can see that service, at the very least.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top