如何在 couchbase 数组中搜索特定字符串
How to search for a specific string in couchbase array
我有 JSON 个以下格式的文档:
{
"id":"1005",
"config":{
"properties":["ABC_001", "DEF_002", "PQR_009"]
}
}
如何搜索与模式“%ABC%”匹配且 ID=1005 的特定 config.properties。在上面的例子中,我的输出应该是
config.properties:ABC_001
这让你接近:
select prop as `config.properties`
from test unnest config.properties prop
where test.id = "1005" and prop like '%ABC%'
这是输出:
[
{
"config.properties": "ABC_001"
}
]
我有 JSON 个以下格式的文档:
{
"id":"1005",
"config":{
"properties":["ABC_001", "DEF_002", "PQR_009"]
}
}
如何搜索与模式“%ABC%”匹配且 ID=1005 的特定 config.properties。在上面的例子中,我的输出应该是
config.properties:ABC_001
这让你接近:
select prop as `config.properties`
from test unnest config.properties prop
where test.id = "1005" and prop like '%ABC%'
这是输出:
[
{
"config.properties": "ABC_001"
}
]