0

I am using docudmentDB(version 3.6) in AWS. I use a python lambda in AWS for this task. The task is to rename a field that is in an array. Here is the sample JSON document I have. Here I need to rename 'version' to 'label'.

{
  "_id": "93ee62b2-4a1f-478f-a716-b4e2f435f27d",
  "egrouping": [
    {
      "type": "Video",
      "language_code": "eng",
      "hierarchy": {
        "pype": {
          "parent": "episode",
          "version": "1",
          "uuid": "933433-4a1f-478f-a716-b4e2f435f27d"
        }
      }
    },
    {
      "type": "Captions",
      "language_code": "eng",
      "hierarchy": {
        "pype": {
          "parent": "episode",
          "version": "1",
          "uuid": "943454-4a1f-478f-a716-b4e2f435f27d"
        }
      }
    }
  ]
}

The following code snippet I tried to rename the 'version' field which is in an error:

collection.aggregate([
    {
        '$project': {
           'egrouping': {
               '$map': {
                   "input": "$egrouping",
                   'as': "egroup",
                   'in': {
                       "hierarchy.pype.label": "$$egroup.hierarchy.pype.version"
                   }
               }
           }
        }
    }
    ])

But I end up with this error:

  "errorMessage": "Aggregation project operator not supported: '$map'",

2 Answers 2

1

Amazon DocumentDB does not support $map. For the complete list of APIs that DocumentDB supports, refer to https://docs.aws.amazon.com/documentdb/latest/developerguide/mongo-apis.html.

We are constantly working backwards from the APIs our customers are looking to use. You can keep an eye on our future launches here https://aws.amazon.com/documentdb/resources/

Sign up to request clarification or add additional context in comments.

Comments

0

The $map operator is now supported, in both Amazon DocumentDB versions, 3.6 and 4.0.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.