Hi, I am new to Couchbase and have been trying this for several hours. Have looked through the documentation but haven’t been able to locate this specific scenario,
My bucket has documents:
{
“type”:“order”,
“order_id”:“1”,
“products”:[{“product_id”:“1”,“qty”:10},{“product_id”:“2”,“qty”:20}]
},
{
“type”:“product”,
“id”:“1”,
“name”:“Product one”
},
{
“type”:“product”,
“id”:“2”,
“name”:“Product two”
}
The product_ids in the “order” type document map to the id field in the “product” type document.
I just need to enhance the order document and get the result as below:
{
“type”:“order”,
“order_id”:“1”,
“products”:[{“product_id”:“1”,“qty”:10,“product_name”:“Product one”},{“product_id”:“2”,“qty”:20,“Product two”}]
}
What N1QL should I use?
Thanks in advance.