#couchdb #fabric-chaincode #fabric-chaincode #couchdb


praviteja@...
 

How to use map reduce functions in Chaincode written in Node js?

I am saving data into couch db in the following format :
1. users collection : {
"id":"user101"
"docType":"user",
"name":"test user",
"active":"true"
}
 documents collection:
{
"id":"doc101",
"userId":"user101",
"documentName":"Test Document",
"docType":"document"
}

I want to query documents along with the user references into it like this:
{"documentname":"Test Document",
"id":"doc101",
"user":{ "userId":101,"name:"test user""}
}

From my reading on the couch db literature it is possible with map reduce functions. 

 How to use  this map reduce functions  in chain code?
 

Join {fabric@lists.hyperledger.org to automatically receive all group messages.