title: error in mgo: result has no field or method
body: <p>I have the following code</p>
  
  <pre><code>package main
  
  import (
      "encoding/json"
      "fmt"
      "labix.org/v2/mgo"
      "labix.org/v2/mgo/bson"
  )
  
  func insertEntry(j *map[string]interface{}, entry string) {
      err := json.Unmarshal([]byte(entry), j)
      if err != nil {
          panic(err)
      }
  
  }
  
  func main() {
      c1 := `{
      "mw" : 42.0922,
          "ΔfH°gas" : {
            "value" : 372.38,
            "units" : "kJ/mol"
          },
          "S°gas" : {
            "value" : 216.81,
            "units" : "J/mol×K"
          },
          "index" : [
            {"name" : "mw", "value" : 42.0922},
            {"name" : "ΔfH°gas", "value" : 372.38},
            {"name" : "S°gas", "value" : 216.81}
          ]
          }`
  
      c2 := `{
      "name": "silicon",
      "mw": 32.1173,
      "index": [
      {
          "name": "mw",
          "value": 32.1173
      }
      ]
      }`
  
      var m map[string]interface{}
  
      insertEntry(&amp;m, c1)
      insertEntry(&amp;m, c2)
      chemical := m["ΔfH°gas"].(map[string]interface{})
      fmt.Println("value: ", chemical["value"].(float64))
      fmt.Println("units: ", chemical["units"].(string))
  
      session, err := mgo.Dial("localhost")
  
      if err != nil {
          panic(err)
      }
      defer session.Close()
  
      // Optional. Switch the session to a monotonic behavior.
      session.SetMode(mgo.Monotonic, true)
  
      c := session.DB("test").C("chemicals")
      err = c.Insert(&amp;m)
      if err != nil {
          panic(err)
      }
  
      result := &amp;m
      err = c.Find(bson.M{"name": "silicon"}).One(&amp;result)
      if err != nil {
          panic(err)
      }
  
      fmt.Println(result)
      fmt.Println("mw:", result.mw)
  }
  </code></pre>
  
  <p>and got the following error</p>
  
  <pre><code>$ go run chemeo.go
  # command-line-arguments
  ./chemeo.go:78: result.mw undefined (type *map[string]interface {} has no field or method mw)
  </code></pre>
  
  <p>How could I print mw out?</p>
  
  <p>Thank you in advance.</p>