N1Ql Connection with CB 3.0

70 views
Skip to first unread message

Ashwini Ahire

unread,
Oct 14, 2014, 9:08:50 AM10/14/14
to couc...@googlegroups.com
couchbase 3.0 Enterprise is compatible with  N1QL Developer Preview 3 ?
What are the steps to connect to bucket.?

I have one bucket having document like below


[
  356,
  422,
  9170*******
]

If i want to select mobile number where telco is 356 then what will be query in n1ql


*************************

CONFIDENTIALITY CAUTION

This communication (including any accompanying documents) is intended only for the use of the addressee(s) and contains PRIVATE AND CONFIDENTIAL information. Unauthorized reading, dissemination, distribution or copying of this communication is prohibited. If you have received this communication in error, please notify us immediately by e-mail and promptly destroy the original communication. Please do not copy it or use it for any other purposes, or disclose its contents to any other person. Unless stated to the contrary, any opinions or comments are personal to the writer and do not represent the official view of the Company. In case where it represents our official view, it needs to be revalidated and is subject to the terms of our engagement.

Thank you for your co-operation.

*************************

Gerald

unread,
Oct 15, 2014, 1:57:31 PM10/15/14
to couc...@googlegroups.com
Hi Ashwini,

Please post the results of the following:

SELECT b FROM __your-bucket-name__ AS b LIMIT 1

ashwini ahire

unread,
Oct 16, 2014, 3:27:03 AM10/16/14
to couc...@googlegroups.com
Hello Gerald,

Please see below o/p

cbq> SELECT b FROM ifa AS b LIMIT 1
{
    "error":
        {
            "caller": "view_index:200",
            "code": 5000,
            "key": "Internal Error",
            "message": "Bucket ifa not found."
        }
}


Also Group by not working in N1QL

cbq> select count(u[1]) as telco , u[0] as country from ifa group by u[0]
{
    "error":
        {
            "caller": "view_index:200",
            "code": 5000,
            "key": "Internal Error",
            "message": "Bucket ifa not found."
        }
}



Regards,
Ashwini Ahire


--
You received this message because you are subscribed to the Google Groups "Couchbase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to couchbase+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gerald Sangudi

unread,
Oct 16, 2014, 1:33:48 PM10/16/14
to couc...@googlegroups.com
Ashwini,

Does your bucket have a password? N1QL does not yet work with SASL buckets.


--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/couchbase/2WSS4bG4dc0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to couchbase+...@googlegroups.com.

Ashwini Ahire

unread,
Oct 17, 2014, 2:51:45 AM10/17/14
to couc...@googlegroups.com
Hello Gerald,

Thanks for your reply , It got resolve when i reset my bucket pwd to blank.

I have one quick question if could help me with this.

how to query below data , If my profile is stored in plain array.

[
123,  - > country Code
865,  -> Telco
456789079  -> Mobilenumber
]

My If i want to select Telco count by country wise , then how to use this array in query.

select doc[0] from ifa limit 1 ;

above query is not working.

Or i will have to update my all profiles with at list one key , eg
{
  "u": [
    123,
    865,
    456789097
  ]
}

Then i did query like select u[0] from ifa limit 1 ; and it works

SO , DO i Need to ADD "u" for all profiles which are already exist



Regards,
Ashwini Ahire | Database Administrator
m. 9819012750

Media Company Of The Year. MMA Smarties

Red Herring Top 100. Asia

mBillionth Award. South Asia

MEET US AT
GamesBeat: 15-16 Sep 2014; San Francisco, USA
GMIC Bangalore: 26 Sep 2014; Bangalore, India
etailing India Summit: 27 Sep 2014; Delhi, India
Mumbai | New Delhi | Singapore | London | San Francisco | Jakarta | Kuala Lumpur | Cape Town
FacebookTwitterGoogle PlusYou TubeLinked In

--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/couchbase/2WSS4bG4dc0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to couchbase+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Gerald Sangudi

unread,
Oct 17, 2014, 11:39:26 AM10/17/14
to couc...@googlegroups.com
Hi Ashwini,

Please post the output of:

select ifa from ifa limit 1

Ashwini Ahire

unread,
Oct 18, 2014, 6:14:34 AM10/18/14
to couc...@googlegroups.com
Hello Gerald,

Please see below output.
Also adding to previous email's questions , My third filed is mobile number .. But its coming in different format


cbq> select * from ifa limit 1
{
    "resultset": [
        {
            "u": [
                764,
                924,
                6.689735454e+10
            ]
        }
    ],
    "info": [
        {
            "caller": "http_response:160",
            "code": 100,
            "key": "total_rows",
            "message": "1"
        },
        {
            "caller": "http_response:162",
            "code": 101,
            "key": "total_elapsed_time",
            "message": "149.476888ms"
        }
    ]
}


Regards,
Ashwini Ahire | Database Administrator
m. 9819012750

Media Company Of The Year. MMA Smarties

Red Herring Top 100. Asia

mBillionth Award. South Asia

MEET US AT
GamesBeat: 15-16 Sep 2014; San Francisco, USA
GMIC Bangalore: 26 Sep 2014; Bangalore, India
etailing India Summit: 27 Sep 2014; Delhi, India
Mumbai | New Delhi | Singapore | London | San Francisco | Jakarta | Kuala Lumpur | Cape Town
FacebookTwitterGoogle PlusYou TubeLinked In

On Thu, Oct 16, 2014 at 12:57 PM, ashwini ahire <ashda...@gmail.com> wrote:

--
You received this message because you are subscribed to a topic in the Google Groups "Couchbase" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/couchbase/2WSS4bG4dc0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to couchbase+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ashwini Ahire

unread,
Oct 18, 2014, 6:26:04 AM10/18/14
to couc...@googlegroups.com
Hello Gerald,

Please ignore my Previous Reply , That was when i added "u" Prfix for each profile.

Below is Original o/p


cbq> select * from ifa limit 1;
{
    "resultset": [
        {}
    ],
    "info": [
        {
            "caller": "http_response:160",
            "code": 100,
            "key": "total_rows",
            "message": "1"
        },
        {
            "caller": "http_response:162",
            "code": 101,
            "key": "total_elapsed_time",
            "message": "111.904553ms"
        }
    ]
}


Regards,
Ashwini Ahire | Database Administrator
m. 9819012750

Media Company Of The Year. MMA Smarties

Red Herring Top 100. Asia

mBillionth Award. South Asia

MEET US AT
GamesBeat: 15-16 Sep 2014; San Francisco, USA
GMIC Bangalore: 26 Sep 2014; Bangalore, India
etailing India Summit: 27 Sep 2014; Delhi, India
Mumbai | New Delhi | Singapore | London | San Francisco | Jakarta | Kuala Lumpur | Cape Town
FacebookTwitterGoogle PlusYou TubeLinked In

Gerald Sangudi

unread,
Oct 18, 2014, 7:26:21 PM10/18/14
to couc...@googlegroups.com
Hi Ashwini,

The fields you want are:

select ifa.u[0]

select ifa.u[1]

select ifa.u[2]

For your third field, I would recommend that you load it as a string. In DP4, we will also add an option to avoid scientific notation.

Thanks.

Gerald

unread,
Oct 18, 2014, 7:28:09 PM10/18/14
to couc...@googlegroups.com
Ok.

Please post the output of:

select ifa from ifa limit 1;

Ashwini Ahire

unread,
Oct 20, 2014, 12:25:53 AM10/20/14
to couc...@googlegroups.com
Hello Gerald,

As i said in my previous email , i had just added "u" as prefix for testing.
But in my Original Profile "u" is not present , Below is my profile.

[
                764,
                924,
                668973545410
]



cbq> select * from ifa limit 1;
{
    "resultset": [
        {}
    ],
    "info": [
        {
            "caller": "http_response:160",
            "code": 100,
            "key": "total_rows",
            "message": "1"
        },
        {
            "caller": "http_response:162",
            "code": 101,
            "key": "total_elapsed_time",
            "message": "111.904553ms"
        }
    ]
}

Please let me know how to select each filed. because here u[0],u[1] wont work.


Regards,
Ashwini Ahire | Database Administrator
m. 9819012750

Media Company Of The Year. MMA Smarties

Red Herring Top 100. Asia

mBillionth Award. South Asia

MEET US AT
GamesBeat: 15-16 Sep 2014; San Francisco, USA
GMIC Bangalore: 26 Sep 2014; Bangalore, India
etailing India Summit: 27 Sep 2014; Delhi, India
Mumbai | New Delhi | Singapore | London | San Francisco | Jakarta | Kuala Lumpur | Cape Town
FacebookTwitterGoogle PlusYou TubeLinked In

Gerald Sangudi

unread,
Oct 22, 2014, 10:15:36 AM10/22/14
to couc...@googlegroups.com
Can you post the results of:

select ifa from ifa limit 1

Thanks.
Reply all
Reply to author
Forward
0 new messages