Hello,
I have the following document in mongo:
{
"_id" : "xxxyyyzzz",
"e" : {
"426" : 1,
"511" : 2,
"400" : 1,
"c" : 5,
"404" : 1
}
}
}
}
The problem here is, the values "400", "511", etc are dynamic. I have 30 such possible values (they are HTTP Error Codes).
When reading from mgo, using Iter.All() I can pass a structure such as
struct Values {
T400 int `bson:"400"`
T401 int `bson:"401"`
....
T511 int `bson:"511"`
}
This works. However, I’m building a chart from these, and if I have to use this, I have to manually compare all these 30 variables and map them into equivalent strings.
Is there an easier way?
Would I be able to get them into an map[string]value, such as
{"400":1, "511":2, "426":1, "404":1}
using mgo.
That would be awesome for me.
Thanks
Sundar.