transaction id from getHistoryForKey() is always undefined in Hyperledger Fabric

Viewed 302

I am working on Nodejs chaincode on Fabric 2.1, when I tried to fetch the history for a key. It returns the "Timestamp" and "value" correctly, but the tx_id in the iterator is always undefined. has anyone successfully retrived the associated transaction ID ??

   async getAllResults(iterator, isHistory) {
    let allResults = [];
    while (true) {
        let res = await iterator.next();

        if (res.value && res.value.value.toString()) {
            let jsonRes = {};
            console.log(res.value.toString('utf8'));
            console.log(res.value.tx_id);
            console.log(res.value.value.toString('utf8'));

logs:

dev-peer0.org1.example.com-mycc_7-7cd3dda|[object Object]
dev-peer0.org1.example.com-mycc_7-7cd3dda|undefined
dev-peer0.org1.example.com-mycc_7-7cd3dda|{"entityType":"product","model":"somemodel","name":"bike","newdata":"somedata","owner":"e7854d50-8793-449a-a903-d740d8d5952b","txDate":"Wed Jul 29 2020"}
1 Answers
Related