Fabric 为CouchDB数据库建立索引

时间:2020…03.06.15.26

首先在链码位置建立文件夹META-INF/statedb/couchdb/indexes/,添加一个json文件如下

{
  "index":{
      "fields":["hashIndex"] // Names of the fields to be queried
  },
  "ddoc":"indexOwnerDoc", // (optional) Name of the design document in which the index will be created.
  "name":"indexOwner",
  "type":"json"
}

然后在安装链码时需定义“installProposalRequest”如下

installProposalRequest.setChaincodeMetaInfLocation(new File(metaInfo ));

其中metaInfo 即是我们刚才建立的文件夹META-INF/statedb/couchdb/indexes/的上级目录即可

你可能感兴趣的:(Fabric)