title: Query to get the most recent quote for each ticker symbol distinctly
body: <p>In Meteor, I have a Quotes collection of price quotes which is a mix of all tracked symbols.  The Quotes collection looks like this:</p>
  
  <pre><code>{ "sym" : "CL", "bid" : 49.29, "ask" : 49.31, "timestamp" : 1424835506105, "_id" : "2yPrQzoZ8MTad8viw" }
  { "sym" : "CL", "bid" : 49.3, "ask" : 49.31, "timestamp" : 1424835512114, "_id" : "oMcsLm2qqkLqWDxpG" }
  { "sym" : "ZB", "bid" : 146.0625, "ask" : 146.09375, "timestamp" : 1424835529244, "_id" : "7XSDNAR8Hx6DmjWhg" }
  { "sym" : "NQ", "bid" : 4445.25, "ask" : 4445.75, "timestamp" : 1424835533854, "_id" : "3AgfZWYAbnWW7pGcc" }
  { "sym" : "YM", "bid" : 18181, "ask" : 18182, "timestamp" : 1424835540869, "_id" : "AQupJnnx2mNMLwSq5" }
  { "sym" : "ZB", "bid" : 146.0625, "ask" : 146.125, "timestamp" : 1424835540870, "_id" : "85eemh5pPQd469cMK" }
  { "sym" : "NQ", "bid" : 4445.25, "ask" : 4445.5, "timestamp" : 1424835540883, "_id" : "7cMmsJqoAkct2CPtm" }
  { "sym" : "NQ", "bid" : 4445.25, "ask" : 4445.75, "timestamp" : 1424835546572, "_id" : "r7zNAuqeQXL7jvnDv" }
  { "sym" : "YM", "bid" : 18181, "ask" : 18183, "timestamp" : 1424835546573, "_id" : "7Dxf2WmhibBuuZrg2" }
  { "sym" : "ES", "bid" : 2112.5, "ask" : 2113, "timestamp" : 1424835577420, "_id" : "yWKtqNjbtSoN2dMzc" }
  { "sym" : "YM", "bid" : 18181, "ask" : 18182, "timestamp" : 1424835577438, "_id" : "bWmmtvdAafxgaNRNJ" }
  </code></pre>
  
  <p>I would like to retrieve only the most recent quote for each sym, which means I need to combine distinct on sym with max on timestamp.  And I am doing this in Meteor.</p>
  
  <p>Is there a single Quotes.find() command that will return this result set?</p>
  
  <pre><code>{ "sym" : "CL", "bid" : 49.3, "ask" : 49.31, "timestamp" : 1424835512114, "_id" : "oMcsLm2qqkLqWDxpG" }
  { "sym" : "ZB", "bid" : 146.0625, "ask" : 146.125, "timestamp" : 1424835540870, "_id" : "85eemh5pPQd469cMK" }
  { "sym" : "NQ", "bid" : 4445.25, "ask" : 4445.75, "timestamp" : 1424835546572, "_id" : "r7zNAuqeQXL7jvnDv" }
  { "sym" : "ES", "bid" : 2112.5, "ask" : 2113, "timestamp" : 1424835577420, "_id" : "yWKtqNjbtSoN2dMzc" }
  { "sym" : "YM", "bid" : 18181, "ask" : 18182, "timestamp" : 1424835577438, "_id" : "bWmmtvdAafxgaNRNJ" }
  </code></pre>