title: Using mongodb go driver for decoding documents into structs with custom type fields
body: <p>I'm a beginner in both go and mongodb.
  I try to decode a <code>DocumentResult</code> into a struct using bson tags, and it does not work for a custom type wrapping a string.
  Can it be done without changing the field's type to a string?</p>
  
  <pre><code>    import (
      "context"
      "github.com/mongodb/mongo-go-driver/mongo"
  )
  
  type MyDoc struct {
      SomeInt int `bson:"some_int"`
      SomeString string `bson:"some_string,omitempty"`
      CustomType MyType `bson:"custom_type,omitempty"`
  }
  
  type MyType string
  
  const myType MyType = "ABCD"
  
  func main() {
  
      //Connect to db
      client, _ := mongo.Connect(context.Background(), "mongodb://localhost:27017", nil)
      db := client.Database("example_db")
      collection := db.Collection("col")
  
      //Insert document
      docToInsert := MyDoc{42, "The Answer", myType}
      collection.InsertOne(nil, docToInsert)
  
      //Retrieve document
      filterDoc := MyDoc{SomeInt: 42}
      resultDoc := &amp;MyDoc{}
      result := collection.FindOne(nil, filterDoc)
      result.Decode(resultDoc)
  
      println(resultDoc.SomeInt, resultDoc.SomeString, resultDoc.CustomType)
  </code></pre>
  
  <blockquote>
    <p>PRINTED RESULT: "42 The Answer" //"ABCD" is missing</p>
  </blockquote>
  
  <p>Thanks in advance</p>