问题
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" },
}
}]
However I am getting the following error:
"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.
回答1:
$_id is not an accumulator function it should be _id
来源:https://stackoverflow.com/questions/44042329/the-field-id-must-be-an-accumulator-object