This is my struct definition:
type Article struct {
Id bson.ObjectId `json:\"id\" bson:\"_id,omitempty\"`
Title string `json:\"t
I've found the problem.
In the code:
Id bson.ObjectId `json:"id" bson:"_id,omitempty"`
between json:
and bson:
, I used a tab
instead of space
so the problem occurs. If I change this line of code to:
Id bson.ObjectId `json:"id" bson:"_id,omitempty"`
With one space
between json:
and bson:
, it turns out to work just fine.