1
如何將轉儲的mongodb轉換爲平面文件? 我繼承了MongoDB的使用GridFS的像mongodb gridfs到平面文件
foo.files.bson
foo.chunks.bson
我進口他們使用mongorestore。 但現在我怎麼能轉儲每個對象到外部文件? 所有的長度大約是29,000,而塊大小 是262,144,所以塊應該是自包含的。
> db.foo.files.find()[0]
{
"_closed" : true,
"_id" : ObjectId("4e9c69e93e3c092c02000001"),
"chunkSize" : 262144,
"comment" : ObjectId("4e9c69e93e3c092c02000000"),
"compression" : "bz2",
"filename" : "my/file",
"is_dft" : true,
"is_gw" : false,
"length" : 22760,
"md5" : "f58c497a0f6127fe70f8240c12d482b6",
"sha512" : "19e3...a2338",
"uploadDate" : ISODate("2011-10-17T17:46:17.312Z"),
"uploader" : null
}
> db.OUTCARs.chunks.find()[0]
{
"_id" : ObjectId("4e9c69e93e3c092c02000002"),
"n" : 0,
"data" : BinData(0,"QlpoOTFsEAjf...UJA8CxbBA="), ******* this is the data to save to a flat file
"files_id" : ObjectId("4e9c69e93e3c092c02000001")
}