I've got a Cosmos DB collection with a document that contains properties that have a special character and what I assume is a reserved word. An example document is:
{
$type: 'Some value',
Value: 'Some other value'
}
If I execute the following query in the Azure Portal Query Explorer:
select * from c where c.Value = 'Some other value'
I receive an error of "Syntax error, incorrect syntax near 'Value'.". I get a similar error querying on c.$type.
How do I escape these property values so that I can query?
In the case of special characters, you will need to wrap the property inside []
Example:
SELECT * FROM c WHERE c["$type"] = "Some value"
SELECT * FROM c WHERE c["value"] = "$Some other value"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With