putprivatedata stores data as attachment when using it in javascript


chandhru24.12@...
 

Hi all,
I'm trying to implement private data collection using javascript,

my application js snippet:
------------------------------------------------------------------------------------
const a={
ID:'asset',
name:'asset1'
}
let resul =await contract1.submitTransaction('EnterLabStaff', Buffer.from(JSON.stringify(a)));

--------------------------------------------------------------------------------------

my  chaincode js snippet:
-------------------------------------------------------------------------------------
async EnterLabStaff(ctx,asset)
{
    await ctx.stub.putPrivateData('labstaffCollection', JSON.parse(asset).ID, Buffer.from(JSON.stringify(asset)));
    return JSON.stringify(asset);
}
---------------------------------------------------------------------------------------

above code stores the 'asset' variable data as attachment in the collection
screen.jpg
instead of adding it as key value pairs,

help me to add as key value pairs

Thanks & Regards,
Chandhru R

Join {fabric@lists.hyperledger.org to automatically receive all group messages.