Javascript MongoError:server localhost:27017收到错误{“名称”:“MongoError”和“消息”:“read EconReset”}
要保存的数据Javascript MongoError:server localhost:27017收到错误{“名称”:“MongoError”和“消息”:“read EconReset”},javascript,node.js,mongodb,mongoose,Javascript,Node.js,Mongodb,Mongoose,要保存的数据 { _id: 56083f1b9a1b20d88c3c3e05, mayfield: false, postponed: false, venue_id: null, venue: null, result: [ null ], league_id: null, away_id: null, home_id: null } { _id: 56083f1b9a1b20d88c3c3e06, mayfield: false, postponed:
{ _id: 56083f1b9a1b20d88c3c3e05,
mayfield: false,
postponed: false,
venue_id: null,
venue: null,
result: [ null ],
league_id: null,
away_id: null,
home_id: null }
{ _id: 56083f1b9a1b20d88c3c3e06,
mayfield: false,
postponed: false,
venue_id: null,
venue: null,
result: [ null ],
league_id: null,
away_id: null,
home_id: null }
代码
var Games = mongoose.model('Games');
var result = new Games();
result.save(function (err, saveData) {
if (err) return console.error(err);
return result;
});
抛出错误
MongoError: server localhost:27017 received an error {"name":"MongoError","message":"read ECONNRESET"}
at null.<anonymous> (c:\var\www\beta.com\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:251:47)
at g (events.js:180:16)
at emit (events.js:98:17)
at null.<anonymous> (c:\var\www\beta.com\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\connection\pool.js:77:12)
at g (events.js:180:16)
at emit (events.js:98:17)
at Socket.<anonymous> (c:\var\www\beta.com\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\connection\connection.js:118:49)
at Socket.g (events.js:180:16)
at Socket.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:442:13)
{ [MongoError: server localhost:27017 received an error {"name":"MongoError","message":"read ECONNRESET"}]
name: 'MongoError',
message: 'server localhost:27017 received an error {"name":"MongoError","message":"read ECONNRESET"}' }
{ [MongoError: server localhost:27017 received an error {"name":"MongoError","message":"read ECONNRESET"}]
name: 'MongoError',
message: 'server localhost:27017 received an error {"name":"MongoError","message":"read ECONNRESET"}' }
当然,我想知道如何停止这个错误,但是没有足够的数据让我理解真正的问题
我已经读到它可能是db的大小,但是在这个特殊的模型上
目前只有6行。所以我不确定,但似乎不太可能
...
league_id: null,
away_id: null,
home_id: null },
{ _id: 56083f1b9a1b20d88c3c3e06,
mayfield: false,
postponed: false,
...
请注意右大括号后的逗号(,)。结果表明,错误是因为我在尝试对数据库进行完整备份时复制了以下文件:
data
¬ db
¬ mays.0
¬ mays.ns
一旦我修复了数据库,整个世界又恢复了良好状态。是运行在
localhost:27017
上的mongod
进程吗?您应该能够执行mongo
来打开shell。此错误与node.js代码无关。检查导致此问题的mongo日志。顺便说一句,您是否尝试重新启动mongo?不幸的是,这只是一个示例。这是从我的控制台.log
获取的。但感谢您指出:)您是指备份的恢复(与访问同时执行)?
data
¬ db
¬ mays.0
¬ mays.ns