Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Azure DocumentDB some queries don't work

I used Azure DocumentDB to store some Key-Values pairs. This is the structure of the document I used

{
    "Key": "Deleted",
    "Value": {
      "email": "[email protected]"
    }
}

When i write DocumentDB query like this,

SELECT C.Value FROM C

This query does not work. Here is the error message I get.

Syntax error, incorrect syntax near 'Value'.

But this query works fine,

SELECT C.Key FROM C

I understand 'Value' should be a keyword in azure documentdb. How can i query it?

like image 502
Kamal Rathnayake Avatar asked Oct 29 '25 01:10

Kamal Rathnayake


1 Answers

Value is a keyword in DocumentDB syntax so this is why you get an error. See Value keyword in this article DocumentDB syntax - The VALUE keyword provides a way to return JSON value.

To get around this you can query it the way Yannick has said i.e.

SELECT C['Value'] FROM C
like image 56
majita Avatar answered Oct 31 '25 02:10

majita



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!