2015-02-06 55 views
0

恢复mongodump后后空集,我做mongorestore这似乎做工精细MongoDB中仍然显示了转储

heathers-air:db heathercohen$ mongorestore -v -host localhost:27017 
2015-02-06T11:22:40.027-0800 creating new connection to:localhost:27017 
2015-02-06T11:22:40.028-0800 [ConnectBG] BackgroundJob starting: ConnectBG 
2015-02-06T11:22:40.028-0800 connected to server localhost:27017 (127.0.0.1) 
2015-02-06T11:22:40.028-0800 connected connection! 
connected to: localhost:27017 
2015-02-06T11:22:40.030-0800 dump/langs.bson 
2015-02-06T11:22:40.030-0800 going into namespace [dump.langs] 
Restoring to dump.langs without dropping. Restored data will be inserted without raising errors; check your server log 
file dump/langs.bson empty, skipping 
2015-02-06T11:22:40.030-0800 Creating index: { key: { _id: 1 }, name: "_id_", ns: "dump.langs" } 
2015-02-06T11:22:40.031-0800 dump/tweets.bson 
2015-02-06T11:22:40.031-0800 going into namespace [dump.tweets] 
Restoring to dump.tweets without dropping. Restored data will be inserted without raising errors; check your server log 
    file size: 4877899 
30597 objects found 
2015-02-06T11:22:41.883-0800 Creating index: { key: { _id: 1 }, name: "_id_", ns: "dump.tweets" } 

当我尝试虽然访问数据,它仍然是空的,之前看的方式恢复:

> show dbs 
admin (empty) 
dump  0.078GB 
local 0.078GB 
tweets (empty) 
twitter (empty) 

它说它发现了30597个物体,他们去了哪里?

+0

输出状态为“已恢复的数据将被插入而不会引起错误;请检查您的服务器日志”。当时你检查了mongod.log文件是否有错误? – 2015-02-06 20:12:16

+0

它读取 '2015-02-06T11:23:31.847-0800 [initandlisten]连接从127.0.0.1:52475#21接受(现在打开6个连接) 2015-02-06T11:23:55.287-0800 [clientcursormon] mem(MB)res:18 virt:2803 2015-02-06T11:23:55.287-0800 [clientcursormon] mapped(incl journal view):320 2015-02-06T11:23:55.287-0800 [clientcursormon] connections: 6 2015-02-06T11:27:13.555-0800 [conn21]结束连接127.0.0.1:52475(现在打开5个连接)' @JamesWahlin – 2015-02-06 21:45:50

+1

您可以使用“use dump”切换到mongo shell中的转储数据库吗?然后运行“显示集合”并发布结果? – 2015-02-06 23:47:03

回答

0

他们进入转储数据库,然后进入收集dump.tweetsdump.langs。文件包含在文件夹dump中的事实意味着mongorestore认为它们应该还原到数据库dump(它是从路径推断的)。详细输出甚至明确指出数据正在被放入dump.langsdump.tweets中。

如果您指定要还原到的数据库(使用-d)并还原特定文件,您将能够将文档还原到所需的数据库。或者,您只需运行以下代码即可查看转储数据库:

use dump; 
db.tweets.find(); 
db.langs.find(); 
相关问题