Mongodb Aggreagate在数小时后因网络错误而失败

Mongodb Aggreagate在数小时后因网络错误而失败,mongodb,Mongodb,尝试使用mongo命令行工具在MongoDB集合上运行聚合失败,数小时后出现网络错误 time mongo 127.0.0.1/db --eval 'db.coll.aggregate([ {$group: { _id: {someField: "$someField", otherField: "$otherField"}, uniqueIDs: {$addToSet: "$_id"}, count: {$sum: 1} } }, {$match: { count: {"$gt": 1} }

尝试使用
mongo
命令行工具在MongoDB集合上运行聚合失败,数小时后出现网络错误

time mongo 127.0.0.1/db --eval 'db.coll.aggregate([ {$group: { _id: {someField: "$someField", otherField: "$otherField"}, uniqueIDs: {$addToSet: "$_id"}, count: {$sum: 1} } }, {$match: { count: {"$gt": 1} } } ], { allowDiskUse:true, cursor:{} }).toArray()' > res.txt
它可以在我的机器上复制,并且在900分钟左右总是失败:

MongoDB shell version v4.0.2
connecting to: mongodb://127.0.0.1:27017/db
MongoDB server version: 4.0.2
2018-12-21T03:31:48.907+0100 E QUERY    [js] Error: error doing query: failed: network error while attempting to run command 'aggregate' on host '127.0.0.1:27017'  :
DB.prototype.runCommand@src/mongo/shell/db.js:168:1
DB.prototype.runReadCommand@src/mongo/shell/db.js:139:16
DB.prototype._runAggregate/doAgg<@src/mongo/shell/db.js:239:60 
DB.prototype._runAggregate@src/mongo/shell/db.js:242:21
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1056:12
@(shell eval):1:1
2018-12-21T03:31:49.093+0100 I NETWORK  [js] trying reconnect to 127.0.0.1:27017 failed
2018-12-21T03:31:49.132+0100 I NETWORK  [js] reconnect 127.0.0.1:27017 failed failed 
2018-12-21T03:31:49.132+0100 I QUERY    [js] Failed to end session { id: UUID("476dd3d7-12a6-48a9-a327-b273f6997711") } due to SocketException: socket exception [CONNECT_ERROR] server [couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused]


real    901m53.846s
user    4m47.900s
sys     2m18.340s
MongoDB外壳版本4.0.2
连接到:mongodb://127.0.0.1:27017/db
MongoDB服务器版本:4.0.2
2018-12-21T03:31:48.907+0100 E QUERY[js]错误:执行查询时出错:失败:尝试在主机“127.0.0.1:27017”上运行命令“聚合”时出现网络错误:
DB.prototype。runCommand@src/mongo/shell/db.js:168:1
DB.prototype。runReadCommand@src/mongo/shell/db.js:139:16
DB.prototype.\u运行聚合/doAgg