1、基于mongo实现远程连接
[plain] view plaincopy
mongo -u admin -p admin 192.168.0.197:27017/pagedb
通过mongo实现连接,可以非常灵活的选择参数选项,参看命令帮助,如下所示:
[plain] view plaincopy
mongo --help
MongoDB shell version: 1.8.3
usage: mongo [options] [db address] [file names (ending in .js)]
db address can be:
foo foo database on local machine
192.169.0.5/foo foo database on 192.168.0.5 machine
192.169.0.5:9999/foo foo database on 192.168.0.5 machine on port 9999
options:
--shell run the shell after executing files
--nodb don't connect to mongod on startup - no 'db address'
arg expected
--quiet be less chatty
--port arg port to connect to
--host arg server to connect to
--eval arg evaluate javascript
-u [ --username ] arg username for authentication
-p [ --pas