![](/img/trans.png)
[英]how to stop update in the CouchDB in hyperledger fabric 1.4 using ui of CouchDB?
[英]How to apply a pagination on array of objects in couchdb using hyperledger fabric?
{
"_id": "usq",
"_rev": "5-f8e9a8853b15f0270df94c1ae71323216",
"transactions": [
{
"admin_notification": [],
"admin_status": "pending",
"payment_amount_usd": "1",
"sp_tx_datetime": "Feb 26, 2021, 12:22 PM",
"sp_tx_hash": "pi_tx1",
"sp_tx_status": "succeeded",
"sp_tx_toAddress": "Admin",
"tx_admin_dateTime": "-",
"user_buyplan_days": "7 Days"
},
{
"admin_notification": [],
"admin_status": "pending",
"payment_amount_usd": "2",
"sp_tx_datetime": "Feb 26, 2021, 4:09 PM",
"sp_tx_hash": "pi_tx2",
"sp_tx_status": "succeeded",
"sp_tx_toAddress": "Admin",
"tx_admin_dateTime": "-",
"user_buyplan_days": "7 Days"
},
{
"admin_notification": [],
"admin_status": "pending",
"payment_amount_usd": "1",
"sp_tx_datetime": "Feb 26, 2021, 12:22 PM",
"sp_tx_hash": "pi_tx3",
"sp_tx_status": "succeeded",
"sp_tx_toAddress": "Admin",
"tx_admin_dateTime": "-",
"user_buyplan_days": "7 Days"
}
],
"user_email": "s@mail.com",
"user_fName": "Sam",
"user_id": "user_2304354",
"user_lName": "Smith",
"user_password": "Abc@123456",
"user_type": "user",
"~version": "CgMBFgA="
}
在這里,我第一次只想要 2 筆交易而不是接下來的交易。 所以我使用了getQueryResultWithPagination方法,但它不適用於單個 object。 所以我創建了一個CouchDB視圖。
"views": {
"tx-view": {
"map": "function (doc) {if(doc.transactions.length > 0) { emit(doc.transactions); }}"
},
"tx-view-2": {
"map": "function (doc) { if(doc.transactions.length > 0) { doc.transactions.forEach(function (tag) { emit(doc.user_id, tag); });}}"
}
},
我可以將此視圖添加到鏈代碼查詢方法中並為其創建事務嗎? 我該如何解決這個問題?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.