Specific user and module match with a SQL++ query

I have a below JSON and I am getting the the user (701) as input . I want to query and check in the json if the user 701 and has modules “Test6”. Tried few but could not make it work .Please help

 "User": [
    {
      "gpid": "701",
      "modules": [
        "Test1",
        "Test2",
        "Test3",
        "Test4",
        "Test5",
        "Test6"
      ]
    },
    {
      "gpid": "700",
      "modules": [
         "Test1",
        "Test2",
        "Test3",
        "Test4",
        "Test5",
        "Test9"
      ]
    },

You could try:

SELECT ...
FROM ...
WHERE gpid = "701"
AND ANY m IN modules SATISFIES m = "Test6" END

Ref: https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/collectionops.html

HTH.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.