We are migrating from mgo to mongo driver and we meet a problem with insert mgo/bson “bson.ObjectId” into MongoDB via mongo driver.
For example, I have a struct:
type Default struct {
ID bson.ObjectId `bson:"_id" json:"id"`
UserID bson.ObjectId `bson:"user_id" json:"user_id"`
}
When I insert this struct in MongoDB, values have a type “string” and looks like this:
{
"_id" : "a\u0016B\u001b�\u001cqGdt��",
"user_id" : "a\u0016B\u001b�\u001cqGdt��"
}
Have anybody ever has the same problem?
Thanks in advance.