我尝试通过以下方式使用 mongoexport 从 MongoDB 导出 json 文件:
$ mongoexport --db db --collection ds --dbpath ~/db --out ds.json
exported 0 records
Sat Apr 20 23:13:18 dbexit:
Sat Apr 20 23:13:18 [tools] shutdown: going to close listening sockets...
Sat Apr 20 23:13:18 [tools] shutdown: going to flush diaglog...
Sat Apr 20 23:13:18 [tools] shutdown: going to close sockets...
Sat Apr 20 23:13:18 [tools] shutdown: waiting for fs preallocator...
Sat Apr 20 23:13:18 [tools] shutdown: closing all files...
Sat Apr 20 23:13:18 [tools] closeAllFiles() finished
Sat Apr 20 23:13:18 [tools] shutdown: removing fs lock...
Sat Apr 20 23:13:18 dbexit: really exiting now
我不明白为什么创建的json文件为空,因为数据库实际上包含以下数据:
$ mongo
MongoDB shell version: 2.2.3
connecting to: test
> use ds
switched to db ds
> db.ds.find().pretty()
{
"_id" : "1_522311",
"chr" : 1,
"kg" : {
"yri" : {
"major" : "D",
"minor" : "A",
"maf" : 0.33036
},
"ceu" : {
"major" : "C",
"minor" : "A",
"maf" : 0.05263
}
},
"pos" : 522311
}
{
"_id" : "1_223336",
"chr" : 1,
"kg" : {
"yri" : {
"major" : "G",
"minor" : "C",
"maf" : 0.473214
},
"ceu" : {
"major" : "C",
"minor" : "G",
"maf" : 0.017544
},
"jptchb" : {
"major" : "C",
"minor" : "G",
"maf" : 0.220339
}
},
"pos" : 223336
}
我做错了什么?
先感谢您。