我有一项资产,并且想更新degreeStatus属性:
asset Degree identified by degreeId {
o String degreeId
o String graduateRut
o String owner
o String degreeType
o String degreeStatus
o String major
o String minor
o String gpa
o String startYear
o String gradYear
o String university
o String[] authorized optional
}
我在Node SDK中具有此功能:
updateDegreeData: async function (degreeId, updateData, uid) {
let cardIdUni = await getUniversityCardId2(uid);
console.log(cardIdUni);
businessNetworkConnection = new BusinessNetworkConnection();
await businessNetworkConnection.connect(cardIdUni);
degreesRegistry = await businessNetworkConnection.getAssetRegistry(namespace + '.Degree');
let degree = degreesRegistry.get(degreeId);
degree.degreeStatus = updateData;
degreesRegistry.update(degree);
return degree
}
它正在返回我要更新但未更新的资产。感谢您的帮助!
答案 0 :(得分:1)
首先,degreesRegistry.update(degree);
是一个承诺,您需要await
。
您可能还想同时使用try{} catch{}
或.catch()
来查看.update()