【发布时间】:2017-01-06 04:42:38
【问题描述】:
我是 MongoDB/Mongoose 的新手,并且正在转储我的 localdb 以便为 heroku 创建一个数据库。当我运行 mongorestore 时,出现以下错误:
2016-08-29T22:05:00.411-0500 building a list of collections to restore from /Users/micahsherman/tmp/mongodump/Loc8r dir
2016-08-29T22:05:00.518-0500 reading metadata for heroku_n1kxxxxxx.locations from /Users/micahsherman/tmp/mongodump/Loc8r/locations.metadata.json
2016-08-29T22:05:00.518-0500 reading metadata for heroku_n1kxxxxxx.test from /Users/micahsherman/tmp/mongodump/Loc8r/test.metadata.json
2016-08-29T22:05:00.519-0500 restoring heroku_n1kxxxxxx.test from /Users/micahsherman/tmp/mongodump/Loc8r/test.bson
2016-08-29T22:05:00.519-0500 restoring heroku_n1kxxxxxx.locations from /Users/micahsherman/tmp/mongodump/Loc8r/locations.bson
2016-08-29T22:05:00.520-0500 restoring indexes for collection heroku_n1kxxxxxx.test from metadata
2016-08-29T22:05:00.574-0500 finished restoring heroku_n1kxxxxxx.test (0 documents)
2016-08-29T22:05:00.799-0500 error: multiple errors in bulk operation:
- E11000 duplicate key error index: heroku_n1kxxxxxx.locations.$_id_ dup key: { : ObjectId('57c334af05803d85c7b9e780') }
- E11000 duplicate key error index: heroku_n1kxxxxxx.locations.$_id_ dup key: { : ObjectId('57c3819605803d85c7b9e783') }
2016-08-29T22:05:00.799-0500 restoring indexes for collection heroku_n1kxxxxxx.locations from metadata
2016-08-29T22:05:00.852-0500 finished restoring heroku_n1kxxxxxx.locations (2 documents)
2016-08-29T22:05:00.852-0500 done
这些会阻止来自 Heroku 的连接。
我已经进入控制台打印了索引,结果如下:
rs-ds017886:PRIMARY> db.system.indexes.find();
{ "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "heroku_n1kxxxxxx.test" }
{ "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "heroku_n1kxxxxxx.locations" }
{ "v" : 1, "key" : { "coords" : "2dsphere" }, "name" : "coords_2dsphere", "ns" : "heroku_n1kxxxxxx.locations", "background" : true, "2dsphereIndexVersion" : 2 }
{ "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "heroku_n1kxxxxxx.objectlabs-system" }
{ "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "heroku_n1kxxxxxx.objectlabs-system.admin.collections" }
rs-ds017886:PRIMARY>
我不太确定如何进行调试。想法??
【问题讨论】:
标签: node.js mongodb heroku mongoose mean-stack