samedi 16 juillet 2016

DocumentDB queries with arrays

I have documents with a simple (string-)array property.

{
     "id": "one",
     "tags": ["A", "B"]
}

{
     "id": "two",
     "tags": ["A", "C"]
}

To check, if a value is part of an array, I could use ARRAY_CONTAINS

SELECT * FROM c WHERE ARRAY_CONTAINS(c.tags, "B")

will return document "one".

How could I query for documents with a list of possible values in the array?

Return all Documents where at least one value of the tags array are IN("B", "C").
-> documents "one" and "two"

Aucun commentaire:

Enregistrer un commentaire