Re: #couchdb #fabric-chaincode #fabric-chaincode #couchdb


David Enyeart
 

Fabric only exposes a subset of CouchDB functionality. JSON queries and associated indexes are supported, but map reduce queries are not supported, since this is not a pattern we expect many databases to support. For more advanced queries (reporting, analytics, etc), the recommendation is to use block events to create a downstream data store that supports the query requirements. See https://hyperledger-fabric.readthedocs.io/en/latest/couchdb_as_state_database.html#good-practices-for-queries.


Dave Enyeart

praviteja---12/27/2019 08:56:33 AM---How to use map reduce functions in Chaincode written in Node js? I am saving data into couch db in t

From: praviteja@...
To: fabric@...
Date: 12/27/2019 08:56 AM
Subject: [EXTERNAL] [Hyperledger Fabric] #couchdb #fabric-chaincode
Sent by: fabric@...





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.