none
Invalid query for key "iS" RRS feed

  • Question

  • If I try to run the following query against a documentdb I get an error:

    SELECT * FROM Random r WHERE r.IS = "abcdefg"

    The exact error message is:

    Exception: Microsoft.Azure.Documents.BadRequestException,
    message: {"errors":[
    {
    "severity":"Error",
    "location":{"start":31,"end":33},
    "code":"SC1001",
    "message":"Syntax error, incorrect syntax near 'IS'."
    }]},
    request URI: rntbd://10.234.120.191:14900/..........

    I suppose that "IS" is a keyword but I couldn't find this anywhere in the documentation. If it is a keyword, how do I escape it? I tried r."IS" and "r.IS" but that doesn't have the desired effect.

    The same happens with the following query:

    SELECT * FROM Random r WHERE r.NOT = "abcdefg"

    Since "NOT" is a keyword, I get that this may not work but again: how to escape this?

    Monday, August 25, 2014 12:40 PM

Answers

  • Do you have a property on your document called "IS"?

    You can escape keywords using [] just like you do in regular T-SQL.

    So, in your case, if IS is a property on your document, it would be :

    SELECT * FROM Random r WHERE r["IS"] = "adcdefg"

    Tuesday, August 26, 2014 5:19 PM

All replies