【发布时间】:2022-03-01 00:29:05
【问题描述】:
我在 AWS 中使用 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"
}
}
}
]
}
以下代码sn-p我尝试重命名'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'",
【问题讨论】:
标签: mongodb-query aws-documentdb aws-documentdb-mongoapi