Query Error on simple query

Hi i have a document with this field:

{
  "_key": "user::jacopo@keepup.pro",
  "_type": "user",
  "email": "jacopo@keepup.pro",
  "password": "prova"
}

And i do this query:

SELECT * FROM lovie WHERE _type='user' AND email='jacopo@keepup.pro' AND password='prova'

But i receive this error:

{
    "requestID": "0f40b5f4-78d2-4b85-a13e-d5bc40940b5e",
    "errors": [
        {
            "code": 3000,
            "msg": "syntax error - at password"
        }
    ],
    "status": "fatal",
    "metrics": {
        "elapsedTime": "2.762101ms",
        "executionTime": "2.709155ms",
        "resultCount": 0,
        "resultSize": 0,
        "errorCount": 1
    }
}

If i delete “AND password=‘prova’” i receive correct field, where am I wrong?

Thanks,
Jacopo

Hey @jacopo,

The word password is on the list of Couchbase N1QL reserved words as seen here:

http://developer.couchbase.com/documentation/server/4.0/n1ql/n1ql-language-reference/reservedwords.html

You can either change your JSON property to something else or escape it with back-ticks like seen here:

http://developer.couchbase.com/documentation/server/4.0/n1ql/n1ql-language-reference/identifiers.html

Let me know if that helps you.

Best,

1 Like

Fantastic!

Thanks very much!

No problem! Reach out if you need further help in the future :smile: