我在亚马逊网络服务中使用docudmentDB(版本3.6)。我在AWS中使用python lambda来完成此任务。任务是重命名数组中的字段。这是我拥有的样例JSON文档。这里我需要将“version”重命名为“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"
}
}
}
]
}下面的代码片段是我尝试重命名“version”字段的时候出错的:
collection.aggregate([
{
'$project': {
'egrouping': {
'$map': {
"input": "$egrouping",
'as': "egroup",
'in': {
"hierarchy.pype.label": "$$egroup.hierarchy.pype.version"
}
}
}
}
}
])但我最终得到了这个错误:
"errorMessage": "Aggregation project operator not supported: '$map'",发布于 2021-05-14 05:12:03
亚马逊DocumentDB不支持$map。有关DocumentDB支持的API的完整列表,请参阅https://docs.aws.amazon.com/documentdb/latest/developerguide/mongo-apis.html。
我们不断地从我们的客户希望使用的API向后工作。您可以在这里关注我们未来的产品发布https://aws.amazon.com/documentdb/resources/
https://stackoverflow.com/questions/67524274
复制相似问题