3

I have Cosmos Db collection, I am trying to query the "Key" "Value" pair from. Working query:

SELECT ed
From c
JOIN ed IN c.ExtendedData
Where ed.Key = "MembershipTypeId"

And got result:

[
    {
        "ed": {
            "Key": "MembershipTypeId",
            "Value": "224"
        }
    }
]

I need to filter by "Key" and "Value", but "Value" appears to be a reserved keyword Not working query:

SELECT ed
From c
JOIN ed IN c.ExtendedData
Where ed.Value = "224"

Got HTTP 400 with message: Syntax error, incorrect syntax near 'Value'

1 Answer 1

3

If property name is the same as reserved word (in this case Value), following syntax could be used:

["Value"]

In the case above here is working query:

SELECT ed 
FROM c 
JOIN ed IN c.ExtendedData 
WHERE ed.Key = "MembershipTypeId" 
AND ed["Value"] = "224"

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.