How to query embedded json (with or without property)


#1

I have a json document called “sample” like this -
{
“config”:{
“is”:
{
“cd”:[“123456”]
,“dv”:[“dtp”,“tbl”]
,“pid”:[“WXYZ”]
}
}
,“ttl”:“2S”
}

I want to know how to find all documents where pid is “abc” when nested json is defined as embedded document.

When its not an embedded document I can query it as below -

SELECT FROM sample WHERE config[“is”].pid CONTAINS(‘abc’)

But the same doesn’t work when config is defined as an embedded document.


#2

Hi @sourav.da

If pid is a collection, then it should work fine. Could you please post a simple SQL script to reproduce the exact case?

Thanks

Luigi