Seddik Ben Lamine
Seddik Ben Lamine

Reputation: 27

Missing data Hyperledger fabric chaincode

I hope you are doing great, I'm new to hyperledger fabric and I have an issue if any one of you got this problem before. I have defined my asset and the attributes related to it in the chaincode in Go and I have developed some functions to interact with the asset, at first it worked fine but lately, I added more data to the Asset and this time when I open couch db and check the data there are some attributes missing, I can build the smart contract with no errors and even the transaction is invoked successfully but when I check I can't find all the defined data.

    //Item:  Define the Item structure, with 9 properties.
type Item struct {
    CurrentOwner    string          `json:"currentOwner"`
    Status          string          `json:"status"`
    Approvedorganic     string             `json:"approvedorganic"`
    ReceptionOlives receptionOlives `json:"receptionOlives"`
    ExtractionHuile extractionHuile `json:"extractionHuile"`
    ElaborationHuile   elaborationHuile   `json:"elaborationHuile"`
    ControleduStockage controleduStockage `json:"controleduStockage"`
    MiseEnBouteille miseEnBouteille `json:"miseEnBouteille"`
    LaboratoryTest  laboratorytest  `json:"laboratorytest"`
}
 
type receptionOlives struct {
    VarieteOlive                    string `json:"VarieteOlive"` //Tunisie Sicile ...
    quantity                        string `json:"quantity"`
    MaturiteOlives                  string `json:"MaturiteOlives"` //vert ou violet ou Noir
    daterecolte                     string `json:"daterecolte"`
    recoltemanuelleouclassique      string `json:"recoltemanuelleouclassique"`
    utilisationdesproduitsdabscission string `json:"utilisationdesproduitsdabscission"`
    dateLivraison                   string `json:"dateLivraison"`
    
}

then when I check the data on any peer's couch db I find that receptionOlives is missing attributes like quantity,daterecolte recoltmanuelleouclassique ... this is the data that I find:

{
  "_id": "Item6",
  "_rev": "6-6dfafa223ebc54e4312a259ea0700934",
  "approvedorganic": "",
  "controleduStockage": {
    "CritereCertificatAlimentariteMaterielStockage": "",
    "CritereMaterielStockage": "",
    "CritereTemperatureStockage": "",
    "CritereTransvasementHuile": ""
  },
  "currentOwner": "Olive mill",
  "elaborationHuile": {
    "CritereSeparationliquideliquide": "",
    "CritereSeparationliquidesolide": ""
  },
  "extractionHuile": {
    "HeureReception": "",
    "HeureTrituration": "",
    "Quantiteeauutilise": "",
    "temperaturePateOlive": ""
  },
  "laboratorytest": {
    "physicochemicalresults": "",
    "tastingresults": ""
  },
  "miseEnBouteille": {
    "StockageMatierepremiere": "",
    "Stockagebouteillevide": "",
    "Temperaturehuile": ""
  },
  "receptionOlives": {
    "MaturiteOlives": "123456789",
    "VarieteOlive": "1234567"
  },
  "status": "Reception",
  "~version": "CgMBHQA="
}

Thank you in advance.

Upvotes: 1

Views: 133

Answers (1)

Sandesh Kumar
Sandesh Kumar

Reputation: 58

You didn't exported the fields of receptionOlives struct. Please export its field by change first letter of field in Uppercase. or replace below code with your struct.

type receptionOlives struct {
    VarieteOlive                    string `json:"VarieteOlive"` //Tunisie Sicile ...
    Quantity                        string `json:"quantity"`
    MaturiteOlives                  string `json:"MaturiteOlives"` //vert ou violet ou Noir
    Daterecolte                     string `json:"daterecolte"`
    Recoltemanuelleouclassique      string `json:"recoltemanuelleouclassique"`
    Utilisationdesproduitsdabscission string `json:"utilisationdesproduitsdabscission"`
    DateLivraison                   string `json:"dateLivraison"`
    
}

Upvotes: 1

Related Questions