分类: Mysql/postgreSQL
2012-04-12 15:56:23
mongo的简单使用:
在mongo_install_dir/bin/mongo 来启动mongo shell,这个可以认为是mongo的客户端, mongo shell下常用的命令: help:查看mongo所有的支持命令具体如下: db.help() help on db methods
db.mycoll.help() help on collection methods
sh.help() sharding helpers
rs.help() replica set helpers
help admin administrative help
help connect connecting to a db
help keys key shortcuts
help misc misc things to know
help mr mapreduce
show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
show logs show the accessible logger names
show log [name] prints out the last segment of log in memory, 'global' is default
use
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line evaluated; use to further iterate
DBQuery.shellBatchSize = x set default number of items to display on shell
exit quit the mongo shell
mongoshell的在linux shell下的使用:
mongo_install_dir/bin/mongo admin --eval "db.shutdownServer()" (这个是关闭mongo server) mongo_install_dir/bin/mongo admin --eval "db.serverStatus()" (查看服务器状态)
mongo_install_dir/bin/mongo admin --eval "mongo shell指令“ (即可执行相关的功能)
mongodb启动问题:
./mongod: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
解决办法:安装 glibc
./mongod: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
安装:libstdc++