字段"$ _id"表示字段"$ _id".必须是一个累加器对象 [英] The Field "$_id" must be an accumulator object
本文介绍了字段"$ _id"表示字段"$ _id".必须是一个累加器对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正试图在$match
阶段之后,在mongoDB中group
某些文档,如下所示:
I am trying to group
some documents within mongoDB, right after a $match
stage like this:
db.trips.aggregate([
{ "$match": {
"Stop Time": {
"$lt": "31.07.2013 23:59"
}
}
},
{ "$group": {
"$_id": { "Start": "$Start", "End": "$End" },
}
}]
但是我遇到以下错误:
字段'$ _id'必须是一个累加器对象"
"The field '$_id' must be an accumulator object"
为什么会显示此错误,为什么只有在包含比赛阶段时才会显示此错误?没有比赛阶段,它就可以正常工作.
Why does this error show up, and why does it only show up when I include the match stage? Without the match stage, it works just fine.
推荐答案
$ _ id 不是累加器函数,应为 _id
$_id is not an accumulator function it should be _id
这篇关于字段"$ _id"表示字段"$ _id".必须是一个累加器对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文