I have a Node app interacting with a Mongo database. When running on the old setup or locally on MongoDB 4.4.0
When I deploy to AWS Document DB 3.6.0 and try to run a query with the below $group clause, I get an error that Feature not supported: $$ROOT
{
$group: {
"_id": "$user_id",
"total_paid_amount": {
$sum: "$amount"
},
"data": {
$push: "$$ROOT"
}
}
}
According to this doc https://docs.aws.amazon.com/documentdb/latest/developerguide/developerguide.pdf, $$ROOT is not supported in DocumentDB
How can I work around this issue, or perform the same query without pushing $$ROOT?
Thanks in advance!