Simple nested paths N1QL not working

Hi,

We have a third-partylibrary that’s using a nested paths query, which is not working due to a"syntax-error". So I tried to create a document and execute the query myself, but still get the same error.

I’m running CouchBase 4.5.1 and I’m trying to execute the following nested paths query:
SELECT * FROM default.primary_contact

But the response I get is a syntax error:
[{
“code”: 3000,
“msg”: “syntax error - at .”,
“query_from_user”: “SELECT * FROM default.primary_contact”
}]

If I instead execute this query, I get the excpected response:
SELECT primary_contact FROM default
{
“primary_contact”: [
{
“name”: “John Smith”,
“phone”: “+1-650-555-1234”
},
{
“name”: “Jane Brown”,
“phone”: “+1-650-555-5678”
}
]
}

Thanks!

It works fine on Couchbase Server 4.5.0-2601 Enterprise Edition (build-2601)

Yes, this syntax has been deprecated. Try

SELECT primary_contact
FROM default;

Just to add to what @geraldss said, this is mentioned in the Release Notes for 4.5.1.

Thanks!

But please consider adding this to the Couchbase 4.5 documentation, it says nothing about it being deprecated in 4.5.1. which is something you don’t expect in a path release.
http://developer.couchbase.com/documentation/server/4.5/n1ql/n1ql-language-reference/from.html

Hi @prasad, @amarantha.

hi @jonny.dahlberg,
we deprecated it in 4.5 and changed the behavior in 4.5.1. Both are documented in respective release notes http://developer.couchbase.com/documentation/server/4.5/release-notes/relnotes.html

However, I see the FROM-clause documentation still uses nested paths in some examples. We will fix that.

thanks.

2 Likes