0

I am new to Node Js. I'm trying to solve an aggregate with unwind keyword. But when I try to add a new field or sort or match it returns an error like this

error": {
        "ok": 0,
        "errmsg": "Unrecognized pipeline stage name: '$addFields'",
        "code": 16436,
        "name": "MongoError",
        "statusCode": 500,
        "status": "error"

I write code like the following (only the part)

      $addFields: {
        month: '$_id'
      }
    },
    {
      $sort: {
        month: 1
      }
    },
    {
      $project: {
        _id: 0
      }
    }```
RMPR
  • 3,368
  • 4
  • 19
  • 31

0 Answers0