说aerospike数据库正在记录如下数据:
姓名年龄特征
sachin 25 MAP('{“ weight”:70,“ height”:25}')
我想通过aql从MAP记录中删除“ height”:25。我该怎么办
答案 0 :(得分:2)
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
}
]
]