sql - DocumentDB queries with arrays -
i have documents simple (string-)array property.
{ "id": "one", "tags": ["a", "b"] } { "id": "two", "tags": ["a", "c"] } to check, if value part of array, use array_contains
select * c array_contains(c.tags, "b") will return document "one".
how query documents list of possible values in array?
return documents @ least 1 value of tags array in("b", "c").
-> documents "one" , "two"
you can combine join operator , used form cross products nested array elements, in operator.
select docs docs join tags in docs.tags tags in ("b", "c") note because creating cross product, result each matching child element, rather each document.
alternatively combine several array_contains or operators, or write udf.
Comments
Post a Comment