如何在nodejs中通过Mongoose使用MongoDB聚合管道运算符
我正在尝试使用汇总计数按日期排列的数据
SELECT OK_imie from Karta_projektu where ID = [And here i need id which user just write].
但是它正在处理“ MongoError:无法识别的表达式'$ convert'”错误
Walkins.aggregate([
{
$match:{'subscriberId': subsc._id},
},{
$project:{'date':{ $convert: { input:'$created', to: "date"} },
} },{
$project:{ 'dates': { $dateToString : { format: "%Y-%m-%d", date: "$created" } }} ,
},{
$group:{
_id:{'date': '$created'} ,
walkinsCount :{$sum: 1 }
}
}
]).then((walkins)=>{ });