Hello,
I’m using MongoDB 5.0.0-rc3 and I would like to create a view for some statistic information of my collection. I have got the following aggregation statement
db.word.aggregate([
{"$group": {
"_id": "$pageid",
"max": {"$max": "$confidence.mean"},
"min": {"$min": "$confidence.mean"},
"avg": {"$avg": "$confidence.mean"}
}}
])
This works well and as expected and I try to convert this into a view with:
db.createView("wordstatistic", "word", [{
"$aggregate": {
"$group": {
"_id": "$pageid",
"max": {"$max": "$confidence.mean"},
"min": {"$min": "$confidence.mean"},
"avg": {"$avg": "$confidence.mean"}
}
}
}])
But I get an error at the $aggregate that this statement is not correct. How can I fix this?
Thanks a lot