'How can i use "Not in" with ARRAY_CONTAINS in Cosmos DB?

I am New to Cosmos DB. I am retrieving records using SQL API.now i want to add "Not In" in ARRAY_CONTAINS. I did lots of R&D for the same but not able to find out any solutions.



Solution 1:[1]

This will find all items where the property resolutions (which is an array) does not contain the value "600".

SELECT VALUE root FROM root WHERE (NOT ARRAY_CONTAINS(root["resolutions"], 600))

Solution 2:[2]

You can add NOT IN simply like below example:

SELECT
    food.id,
    food.description,
    food.tags,
    food.foodGroup
FROM 
  food    
WHERE food.id
NOT IN ('ID1', 'ID2', 'ID3')

This is tested and will work like a charm.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Niels Brinch
Solution 2 Krishan Pal