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. 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?
|
|