当我试图在游标上迭代时,我会得到以下错误
TypeError: _challengeModel2.default.aggregate(...).forEach is not a function这是我的疑问
const completed = Challenge.aggregate([]).toArray()有谁能帮我解决这个问题,并简要解释一下mongodb中的游标
我使用的是猫鼬5.x和MongoDB4.0
发布于 2018-08-28 14:18:26
不能将聚合管道转换为数组,但可以这样编写:
const completed = Challenge.aggregate([],(err,results) =>{
console.log(results)
})
https://stackoverflow.com/questions/51614118
复制相似问题