I have a PersonalAccount
type as
type PersonalAccount struct {
ID bson.ObjectId `json:"id" bson:"_id,omitempty"`
}
then I get a marshaled PersonalAccount
through an HTTP request, and the data is unmarshaled successfully and when I check the ID type.
It is a bson.ObjecID
The problem is when I try the code below:
var m PersonalAccount = unmarshaledAccount
mgo.DB("dbname").C("colname").FindId(m.ID)
It returns an error that says it is not found.
I have also tried:
var m PersonalAccount = unmarshaledAccount
mgo.DB("dbname").C("colname").Find(bson.M{"_id": m.ID})
but with no luck.