title: How to represent an array with mixed types
body: <p>I am constructing an aggregation pipeline query with the <code>$substr</code> command from MongoDB but I don't know how to represent the array it requires in Go with the mgo driver because it contains different types of values (string, int).</p>
  
  <p>Here is the query in javascript:</p>
  
  <pre><code>[ {$group: {"_id": {"dt": {"$substr": ["$dt",0,6]}}}} ]
  </code></pre>
  
  <p>What this is trying to do is get the substring of <code>dt</code> (from the previous stage of aggregation) with starting index 0 and ending index 6.</p>
  
  <p>In Go i got:</p>
  
  <pre><code>[]bson.M{"$group": bson.M{"_id": bson.M{"dt": bson.M{"$substr": ["$dt",0,6]}}}}}
  </code></pre>
  
  <p>but <code>["$dt",0,6]</code> is not a correct representation and everything I tried seems to fail.</p>