我正在尝试恢复mongo数据库转储。在PC上运行mongorestore工作正常。但是当我在Linux服务器(64位MongoDB)上运行它时,不会抛出任何错误,但不会导入数据。 以下是终端上的消息:
#mongorestore --drop dump
connected to: 127.0.0.1
Sun Nov 4 11:56:13 dump/m101/hw1.bson
Sun Nov 4 11:56:13 going into namespace [m101.hw1]
Sun Nov 4 11:56:13 dropping
1 objects found
Sun Nov 4 11:56:13 Creating index: { key: { _id: 1 }, ns: "m101.hw1", name: "_id_" }
Sun Nov 4 11:56:13 dump/m101/funnynumbers.bson
Sun Nov 4 11:56:13 going into namespace [m101.funnynumbers]
Sun Nov 4 11:56:13 dropping
100 objects found
Sun Nov 4 11:56:13 Creating index: { key: { _id: 1 }, ns: "m101.funnynumbers", name: "_id_" }
编辑:
这不是问题。问题不在于插入,而在于我的查询。我试图做db.m101.funnynumbers.count()。这样做的正确方法是db.funnynumbers.count()。