Select Query syntax error with the type



I have inserted a user document. when I run the below SELECT query, I can see the result as shown below.

SELECT * FROM my_buckt WHERE type = “user”

“my_buckt”: {
“createdTs”: xxxxx,
“createdBy”: “xxxx”,
“data”: {
“title”: test
“type”: “user”,
“uuid”: “xxxxxxxxx”

But when i try to run the below query, it is giving an error. I just added the type after the bucket name. Please advise what I’m missing in order to make it work for the below SELECT query.
SELECT * FROM my_buckt user WHERE type = “user”

“code”: 3000,
“msg”: “syntax error - at user”,


Try this. Since user is a keyword, you’ll have to use backquote(`) around to escape reserved words… in this case the bucket alias user.


I tried it but no luck.!! Looks like this forum editor is ignoring backquote
SELECT * FROM my_buckt user WHERE type = “user”


We can’t use the couchbase reserved keyword “user” and this is not an issue of type='user, this issue is in “my_buckt user”. If you change user to other than reseved keyword like “mybucket user1” it will work. Ex:

SELECT * FROM my_buckt user1 WHERE type = “user”


If IDENTIFIER/field are reserved keywords those must be escaped as described here

SELECT * FROM my_buckt `user` 
WHERE type = "user";