Unable to access data added to default bucket using N1QL

Hello,

I have added data to the default bucket, however I am told by N1QL that there is no data when I run “Select * FROM default;”.

Here is the what happens when I run the command.

“cbq> Select * FROM default;
{
“requestID”: “07d6d2b7-a399-4460-882c-164c4329d58a”,
“signature”: {
": ""
},
“results”: [
],
“status”: “success”,
“metrics”: {
“elapsedTime”: “19.269814ms”,
“executionTime”: “18.830218ms”,
“resultCount”: 0,
“resultSize”: 0
}
}"

However, when I go to the default bucket in http://localhost:8091/ I see the data is added.

I am able to retrieve the data from beer-sample with no problem. I also followed the steps in N1QL - Getting Started but I have done everything in those steps already with no luck.

Thank you for any insight you can provide.

Sorry for the delay in replying.

You need to use backticks around the bucket name. So, this should work:

Select * FROM `default`;

Let me know if that helps.

Let me clarify a bit what @matthew said: you need to use backticks if your bucket name has restricted characters in there, like “-”. So for default it should be fine, but it’s best practice to always do it like this.

Now onto your question: How quickly did you add the data before querying? Because by default the index is updated eventually, which means it might take some time that it is included in the results. You can use query parameters to override that behaviour.

Also, which index type are you using?