I have mongo database with following schema
{
"_id" : ObjectId("55c8526d8c16598efb5ee1e6"),
"guid" : "72811d52b48379e72c8fdd11aa09cb8b",
"blkid" : 1,
"vblkid" : 0,
"spltid" : 0,
"cmpr" : false,
"encr" : false,
"chksum" : "",
"dup" : false,
"cid" : 1,
"off" : 524508,
"len" : 524408,
"incr" : 0,
"fBackupID" : 0,
"vid" : 0,
"plugInType" : 0,
"blkType" : 0,
"alen" : 0
}
and I am trying to parse these into a struct with following structure:
type VhfsBlockMD struct {
GUID string `json:"guid"`
BlkID int `bson:",minsize" json:"blkid"`
VBlkID int `bson:",minsize" json:"vblkid"`
SpltID int `bson:",minsize" json:"spltid"`
Cmpr bool `json:"cmpr" `
Encr bool `json:"encr"`
Blksum string `bson:"blksum,omitempty" json:"blksum,omitempty"`
Chksum string `json:"chksum"`
Dup bool `json:"dup"`
Cid int `bson:",minsize" json:"cid"`
SplitLen int `bson:",minsize" json:"len"`
Off int64 `bson:",minsize" json:"off"`
Incr int `bson:",minsize" json:"incr"`
CDup bool `bson:"cdup,omitempty" json:"cdup,omitempty"`
FBackupID int `bson:"fBackupID" json:"fBackupID"`
Vid int `bson:"vid" json:"vid"`
PlugInType int `bson:"plugInType" json:"plugInType"`
BlkType int `bson:"blkType" json:"blkType"`
Alen int `bson:"alen" json:"alen"`
IsValid int `bson:"-" json:"-"`
Len uint64 `bson:"-" json:"-"`
}
I am using mgo driver.
Now problem is that after parsing only attribute i am not able to parse correctly is "len" (SplitLen in go struct).
len is defined as
SplitLen int `bson:",minsize" json:"len"`
I believe it has something to do with tags. Also i would lke to mention that same struct was used to insert value into mongodb.
Any help would be appreciated.