title: Cannot decode null into a string type
body: <p>I am trying to decode a struct which contains a result field, where the result field is either a null or string value. I'm trying to decode this into a string pointer but I get the error: </p>
  
  <pre><code>type MyStruct struct {
      Result   *string `json:"result,omitempty" bson:"result"`
  }
  </code></pre>
  
  <p>The bson/json is something like:</p>
  
  <pre><code>{"result" : null}
  </code></pre>
  
  <p>or </p>
  
  <pre><code>{"result" : "somedata"}
  </code></pre>
  
  <p>Decode with:</p>
  
  <pre><code>var result MyStruct
  
  err := collection.FindOne(ctx, filter).Decode(&amp;result)
  if err != nil {
      s.logFile.Fatal(err)
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>cannot decode null into a string type
  </code></pre>
  
  <p>I'm using the official driver: "github.com/mongodb/mongo-go-driver/mongo" &amp; "github.com/mongodb/mongo-go-driver/x/bsonx"</p>