title: Insert data in MongoDB using mgo
body: <p>I'm trying to insert some data in MongoDB using mgo but the outcome is not what I wanted.</p>
  
  <p><strong>My struct</strong></p>
  
  <pre><code>    type Slow struct {
      Endpoint string
      Time     string
      }
  </code></pre>
  
  <p><strong>My insert statement</strong></p>
  
  <pre><code>err := collection.Insert(&amp;Slow{endpoint, e}) 
  if err != nil {
      panic(err)
  }
  </code></pre>
  
  <p><strong>How I'm trying to print it</strong></p>
  
  <pre><code>    var results []Slow
  
      err := collection.Find(nil).All(&amp;results)
      if err != nil {
          panic(err)
      }   
      s, _ := json.MarshalIndent(results, "  ", "  ")
      w.Write(s)
  </code></pre>
  
  <p><strong>My output (Marshaled JSON)</strong></p>
  
  <pre><code>   [{
         "Endpoint": "/api/endpoint1",
         "Time": "0.8s"
      },
      {
         "Endpoint": "/api/endpoint2",
         "Time": "0.7s"
      }]
  </code></pre>
  
  <p><strong>What I wanted</strong></p>
  
  <pre><code>    {
        "/api/endpoint1":"0.8s",
        "/api/endpoint2":"0.7s"
      }
      //No brackets
  </code></pre>
  
  <p>Thank you.</p>