Can not query ```when``` or ```object``` fields

n1ql

#1

I am using Couchbase Server 4.1.0-5005 Enterprise Edition (build-5005)
My doc like this:

{"type":"SAMPLE","when": 1454765217478,"object":"obj-1"}

I can not query when or object fields,like:

select `when` from mydb
select `object` from mydb

return

    "errors": [
        {
            "code": 3000,
            "msg": "syntax error - at `when`"
        }
    ]

but I can query data by condition on when or object (but also can not query when or object fields)

select * from mydb where `object` == "obj-1";

#2

Sorry, my mistake,
I am using

select `a.when` from mydb a

to escape the reserved words, It not works,
but when I am using

select  a.`when` from mydb a

It works.


#3

@geraldss could this be a bug? I guess an identifier should not fail if it contains a reserved word?


#4

Hi @daschl, no bug. He got an error message, and he fixed his query and it now works. Thanks.


#5

Okay great, I guess I got confused by the original samples then