当我尝试读取大量记录时,出现以下错误。
MongoError:游标不存在,被杀死或超时
我的代码
let cursor = Transaction.find(query,{},{timeout: true}).cursor()
cursor.eachAsync((tx) => {
console.log('tx', tx);
dataSet.push(tx);
})
.then(() => {
console.log('dataset',dataSet)
resolve(dataSet);
})
.catch(err => {
console.log("error in query: ", err.message," error code:",err.code);
reject(apiError('KFWE0001'));
});
答案 0 :(得分:0)
更改为:
Transaction.find(query,{},{timeout: false}).cursor()