N1Ql select * adds bucket name to result set

A simple N1Ql select statement – SELECT * FROM my_bucket where doc_type = “product” --returns a result set that contains the bucket name as a root level key that is not wanted in the result set. Is there a way to exclude the bucket name key at the root level?

Thanks…

[
{
my_bucket”: {
"_id": “111”, “barcode_url”: “https://www.barcodesinc.com/generator/image.php?code=111&style=197&type=C128B&width=180&height=50&xres=1&font=3”,
“created_date”: “2017-08-14T07:41:33.521149”,
“doc_type”: “product”,
“last_updated_date”: “2017-08-14T07:41:33.521149”,
“price”: 9.95,
}
},
{
my_bucket”: {
"_id": “120”,
“barcode_url”: “https://www.barcodesinc.com/generator/image.php?code=120&style=197&type=C128B&width=180&height=50&xres=1&font=3”,
“created_date”: “2017-08-14T07:41:33.514149”,
“doc_type”: “product”,
“last_updated_date”: “2017-08-14T07:41:33.514149”,
“price”: 44.55,
}
}
]

SELECT my_bucket.* FROM my_bucket where doc_type = "product";
SELECT d.* FROM my_bucket AS d where d.doc_type = "product";

Excellent, thanks for the quick reply. So, the first statement didn’t work for me. The result set was just a bunch of empty objects. However the second statement did work. So i’ll use that construct.

Is there any official documentation that refers to this. I wallowed in Google for a good while, but did not find anything relevant.

Thanks a lot vsr1!!!

First should also work. You need to give source bucketname.*, If bucketname in FROM caluse is aliased you need to refer it as that alias.

When you say * in projection it projects sources as it its. If you need the values inside source you need to reference them explicitly.
https://developer.couchbase.com/documentation/server/current/n1ql/n1ql-language-reference/selectintro.html