How do I query for a document with a bucket?


#1

Hi All,

Can tell me how to run a query for a document within a bucket using n1ql3 and CB 2.2? Following the instructions I am able to run n1ql against CB and query my bucket, e.g:

cbq> ericg:[23]: ./cbq -engine <LOCAL_HOST_URL:8093>
cbq> select * from cloudpass limit 1
{
“resultset”: [
{ <-- get expected data here

}
}

However when I try to query a document with the cloudpass bucket the engine crashes, e.g:
cbq> select * from cloudpass.app_categories
09:18:56.508889 ERROR: Post localhost:8093/query: EOF – main.HandleInteractiveMode() at interactive.go:54

with the following engine exception:
09:28:22.203995 site: localhost:8091
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x28 pc=0x25252]

goroutine 85 [running]:
created by github.com/couchbaselabs/tuqtng/xpipeline.(*BaseOperator).RunOperator
/home/manik/tuqtng/src/github.com/couchbaselabs/tuqtng/xpipeline/base.go:100 +0xe3

goroutine 1 [chan receive]:
github.com/couchbaselabs/tuqtng/server.Server(0x807188, 0x6, 0x7fff5fbffbd8, 0x15, 0x4b2d60, …)
/home/manik/tuqtng/src/github.com/couchbaselabs/tuqtng/server/server.go:66 +0x4f4
main.main()
/home/manik/tuqtng/src/github.com/couchbaselabs/tuqtng/main.go:74 +0x350

Any pointer as to how I can query for a document within a bucket is greatly appreciated. The environment is n1ql3, CB2.2 on a Mac.

Sincerely,

Eric Gilbertson
eric.gilbertson@totvs.com


#2

Hi Eric,

It seems you’ve hit a bug. Please try:

select app_categories from cloudpass

Thanks.


#3

Hi Gerald,

I tried “select app_categories from cloudpass”. It returns and empty JSON response for each entry in the document, e.g:

cbq> select app_categories from cloudpass
{
“resultset”: [
{},
{},

}

However, the following did return the expected results:

cbq> select * from cloudpass key “app_categories”
{
“resultset”: [
{
“Blogging”: {
“companyId”: “”,
“description”: “Blogging Apps”,

}

Regards,

Eric Gilbertson


#4

Hi Eric,

Thanks for the update.

-Gerald