Using reserved word field name in DocumentDB Using reserved word field name in DocumentDB sql sql

Using reserved word field name in DocumentDB


You are correct. Value is a reserved keyword. To escape this use [""] syntax.

So in your case of

"Alternates": [ "Type": "ID", "Value" : "NOCALL" ]

SELECT c FROM cJOIN alt IN c.AlternatesWHERE alt["Value"] = 'NOCALL'


In my case, the structure looks something like this - { "name": "ABC", "Value": 123 }.

I could escape the reserved keyword using [""] (as answered by others) along with <source_name> i.e.

SELECT c["Value"] FROM c -- 123

Ref.: Querying in Azure Cosmos DB