首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

MongoDB下令备忘

2013-12-04 
MongoDB命令备忘??????????????????????????????????????? start up? --quiet???????????????????????????

MongoDB命令备忘
??????????????????????????????????????? start up
? --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 [ --password ] arg???????????????? password for authentication
? --authenticationDatabase arg????????? user source (defaults to dbname)
? --authenticationMechanism arg (=MONGODB-CR)
??????????????????????????????????????? authentication mechanism
? -h [ --help ]???????????????????????? show this usage information
? --version???????????????????????????? show version information
? --verbose???????????????????????????? increase verbosity
? --ipv6??????????????????????????????? enable IPv6 support (disabled by
??????????????????????????????????????? default)

file names: a list of files to run. files have to end in .js and will exit after
?unless --shell is specified


E:\mongodb>bin\mongo -port 10000
MongoDB shell version: 2.4.8
connecting to: 127.0.0.1:10000/test
Server has startup warnings:
Sun Nov 24 11:24:51.515 [initandlisten]
Sun Nov 24 11:24:51.515 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary
.
Sun Nov 24 11:24:51.515 [initandlisten] **?????? 32 bit builds are limited to le
ss than 2GB of data (or less with --journal).
Sun Nov 24 11:24:51.515 [initandlisten] **?????? Note that journaling defaults t
o off for 32 bit and is currently off.
Sun Nov 24 11:24:51.515 [initandlisten] **?????? See http://dochub.mongodb.org/c
ore/32bit
Sun Nov 24 11:24:51.515 [initandlisten]
Sun Nov 24 11:24:51.515 [initandlisten] ** NOTE: your operating system version d
oes not support the method that MongoDB
Sun Nov 24 11:24:51.515 [initandlisten] **?????? uses to detect impending page f
aults.
Sun Nov 24 11:24:51.515 [initandlisten] **?????? This may result in slower perfo
rmance for certain use cases
Sun Nov 24 11:24:51.515 [initandlisten]
> help
??????? 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
??????? 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 wit
h time >= 1ms
??????? show logs??????????????????? show the accessible logger names
??????? show log [name]????????????? prints out the last segment of log in memor
y, 'global' is default
??????? use <db_name>??????????????? set current database
??????? 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 f
urther iterate
??????? DBQuery.shellBatchSize = x?? set default number of items to display on s
hell
??????? exit???????????????????????? quit the mongo shell
> show dbs;
local?? 0.03125GB
> use mydb;
switched to db mydb
> show dbs;
local?? 0.03125GB
> db.myc.save({a:10});
> db.myc.find();
{ "_id" : ObjectId("529172a4eac97f31b4051e3b"), "a" : 10 }
> show collections;
myc
system.indexes
> show dbs;
local?? 0.03125GB
mydb??? 0.0625GB
> db.dropDatabase();
{ "dropped" : "mydb", "ok" : 1 }
> show dbs;
local?? 0.03125GB
> exit;

E:\mongodb>exit

?

==================================================

**************
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************

E:\mongodb>bin\mongod --repair --dbpath data\db

?

其他命令可以参考:

http://blog.csdn.net/wangpeng047/article/details/7705588

?

下载:

http://www.mongodb.org/downloads

https://github.com/mongodb/mongo-java-driver/downloads

?

热点排行