2016-08-03 63 views
0

我想使用N1ql將整個文檔存儲在存儲桶中 我的文檔名稱是CR_5031_114156723_2016-08-02,其他CR號碼對於不同的文檔將有所不同。想要獲取整個文檔使用N1ql couchbase

I tried with below 2 query but getting only OrderDetails details 
select d.* from Delivery.OrderDetails d where d.orderId in ['114156723'] 

select d.*,Delivery.OrderLines from Delivery.OrderDetails d where d.orderId in ['114156723'] 

Delivery is my bucket Name 

Below is the document 
Please help me in writing a query to get entire document 

{ 
"OrderDetails": { 
"orderId": "114156737", 
"vanNumber": "5J", 
"voucherPromotionName": "Computers for Schools", 
"customerNumber": "85516242", 
"shortOrderNumber": "4692", 
"VoucherName": "Clubcard Voucher" 
}, 
"OrderLines": { 
"Product": [ 
{ 
"isApplicableForVat": "N", 
"productQuantity": "6", 
"productId": "52599951", 
"productDescription": "Ni Pstrd S/Skimmed Milk 3ltr " 
}, 
{ 
"isApplicableForVat": "Y", 
"productQuantity": "1", 
"productId": "55771771", 
"productDescription": "Dale Farm Vanilla Ice Cream 1ltr *" 
} 
] 
}, 
"DeliveryDetails": { 
"deliverySlotStartTime": "20:00", 
"deliverySlotEndTime": "21:00" 
}, 
"ECoupons": { 
"coupon": "0.0000" 
}, 
"_class": "com.model.CustomerReceipt", 
"OutOfStockProducts": {}, 

} 

我試着用以下2查詢,但只獲得訂單明細詳細 選擇d。*從Delivery.OrderDetails D其中d.orderId在[ '114156723']

select d.*,Delivery.OrderLines from Delivery.OrderDetails d where d.orderId in ['114156723'] 

Delivery is my bucket Name 

感謝

回答

1

完成此操作以獲取完整文檔:

select d from Delivery d where d.OrderDetails.orderId in ['114156723']