0

Using a query for Cosmos, how do I select out all Roles that have an ID of '11'?

{
   "Roles":[
      {
         "Name":"Admin",
         "ID":[
            "11",
            "22",
            "33"
         ]
      },
      {
         "Name":"User",
         "ID":[
            "11"
         ]
      }
   ]
}

I think it sort of looks like this but not sure about the where clause...

select value r from c join r in c.Roles join i in r.ID // where i = ??

1 Answer 1

1

Please try something like this:

select value r from c join r in c.Roles where ARRAY_CONTAINS(r.ID,'11',false)

Hope this can help you:).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.