Query single value array

Hi all,
I have documents in couchbase in below format.

{
            "attributes": [
              "categories",
              "brand"
            ],
           "typeOfInputData": "Web page",
            "weight": 100,
            "type": "test"
          }

I want to fetch documents where the attribute field contains the exact values.
Considering above json, how can I query to Couchbase that it would return me above document where “attributes” array contains “categories” and “brand” (exact match) ?

If you want order must be preserved and exact match

SELECT d.* 
FROM default AS d
WHERE d.attributes =  [ "categories", "brand" ];

If you want any order and array must contain both the values (attribute might have other values too)

SELECT d.* 
FROM default AS d
WHERE  ANY v IN d.attributes SATISFIES v = "categories" END 
              AND ANY v IN d.attributes  SATISFIES v = "brand" END;

OR

SELECT d.* 
FROM default AS d
WHERE  EVERY v IN [ "categories", "brand" ]  SATISFIES v IN d.attributes END;

If you want any order and exact match (no additional values in array)

SELECT d.* 
FROM default AS d
WHERE  EVERY v IN  d.attributes  SATISFIES v IN  [ "categories", "brand" ]  END;

Thanks a :+1:lot, that worked