【发布时间】:2018-04-22 12:57:09
【问题描述】:
我有如下聚合查询,
ResearchPapers.aggregate([
{
$match: params
},
{
$group: {
_id: "$pmid"
},
"Title": {
"$first": "$Title"
},
"url": {
"$first": "$url"
},
"year": {
"$first": "$year"
},
"month": {
"$first": "$month"
},
"day": {
"$first": "$day"
}
},
{
$sort: {
year: -1,
month: -1,
date: -1
} }]).exec(function(cerr, records){
if(cerr){
return console.log(cerr);
}
});
当我执行我的查询时,我得到的错误是`
Error: Arguments must be aggregate pipeline operators
我找不到 sol,我是 node js 和 mongoose 的新手。谁能给我建议帮助。谢谢。
【问题讨论】:
-
你能分享一下你到底想做什么。
标签: node.js express mongoose mean-stack