MongoDB shell version: 2.6.10
connecting to: test
> show dbs; #查看数据库
admin (empty)
local 0.078GB
> use local; #切换到local数据库
switched to db local
> show collections; #查看当前有哪些collection
startup_log
system.indexes
> db.startup_log.findOne(); #执行查询,并返回一个单独的文档
{
"_id" : "localhost.localdomain-1436760955339",
"hostname" : "localhost.localdomain",
"startTime" : ISODate("2015-07-13T04:15:55Z"),
"startTimeLocal" : "Mon Jul 13 12:15:55.339",
"cmdLine" : {
"net" : {
"port" : 27017
},
"processManagement" : {
"fork" : true
},
"storage" : {
"dbPath" : "/data/mongo/data"
},
"systemLog" : {
"destination" : "file",
"path" : "/data/mongo/logs/mongodb.log"
}
},
"pid" : NumberLong(10799),
"buildinfo" : {
"version" : "2.6.10",
"gitVersion" : "5901dbfb49d16eaef6f2c2c50fba534d23ac7f6c",
"OpenSSLVersion" : "",
"sysInfo" : "Linux build18.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49",
"loaderFlags" : "-fPIC -pthread -Wl,-z,now -rdynamic",
"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -pipe -Werror -O3 -Wno-unused-function -Wno-deprecated-declarations -fno-builtin-memcmp",
"allocator" : "tcmalloc",
"versionArray" : [
2,
6,
10,
0
],
"javascriptEngine" : "V8",
"bits" : 64,
"debug" : false,
"maxBsonObjectSize" : 16777216
}
}
> exit #退出
bye