2021年1月5日星期二

How to replace $$ROOT for group in AWS DocumentDB - Feature not supported: $$ROOT

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!

https://stackoverflow.com/questions/65588793/how-to-replace-root-for-group-in-aws-documentdb-feature-not-supported-roo January 06, 2021 at 09:04AM

没有评论:

发表评论