Hi folks,
The documentation I've read so far appears slightly vague
about how to properly handle reading int64 values out of
mongo when using mgo.
Is the proper technique something along the lines of the following,
for the example of a incrementing a sequence counter?
...
collection := session.DB(db).C(collection)
locate := bson.M{"_id": id}
change := mgo.Change{
Update: bson.M{"$inc": bson.M{"n": 1}},
Upsert: true,
ReturnNew: true}
result := bson.M{}
info, err := collection.Find(locate).Apply(change, &result)
...
var n int64
switch t := result["n"].(type) {
case int:
n = int64(t)
case int32:
n = int64(t)
case int64:
n = t
default:
... error case ...
}