удаление значения bin в записи аэробайка db, которая имеет тип карты - PullRequest
1 голос
/ 05 ноября 2019

говорят, что в базе данных аэроспайков есть записанные данные, как показано ниже:

название возрастных характеристик
sachin 25 MAP ('{"weight": 70, "height": 25}')

Я хочу удалить "высоту": 25 из записи MAP через aql. Как я могу это сделать

1 Ответ

2 голосов
/ 06 ноября 2019
aql> insert into test.demo (pk, name, age) values ("s", "sachin", 25)
aql> operate map_put(props, "height", 25) on test.demo where pk="s"
aql> operate map_put(props, "weight", 70) on test.demo where pk="s"
aql> set output json
OUTPUT = JSON
aql> select * from test.demo where pk="s"

[
    [
        {
          "name": "sachin",
          "age": 25,
          "props": {
            "height": 25,
            "weight": 70
          }
        }
    ],
    [
        {
          "Status": 0
        }
    ]
]

aql> operate map_remove_by_key(props, "height") on test.demo where pk="s"

[
    [
        {
          "props": [
            "height",
            25
          ]
        }
    ],
    [
        {
          "Status": 0
        }
    ]
]

aql> select * from test.demo where pk="s"

[
    [
        {
          "name": "sachin",
          "age": 25,
          "props": {
            "weight": 70
          }
        }
    ],
    [
        {
          "Status": 0
        }
    ]
]
...