Hi all,
I would like to know how I can query a particular value from a nested structure that has the same key
Here is a sample nested structure like a dictionary.
I want to query code for all item from product
"products":{ "itemA":{ "price" : $10, "code": 123, "importTime": "2000/01/01" }, "itemB":{ "price" : $10, "code": 456, "importTime": "2010/01/01" }, "itemC":{ "price" : $10, "code": 789, "importTime": "2020/05/12" } }
This is what I’ve tried in command line.
SELECT OBJECT_VALUES(products)[*].code FROM
bucket_name
Returns
[ { "code": [ 123, 456, 789 ] } ]
I’m looking for a returned result as below
[ { "itemA":{ "code": 123, }, "itemB":{ "code": 456, }, "itemC":{ "code": 789, } } ]
Thanks in advance.