title: MongoDB converting date to string
body: <p><strong>PROBLEM:</strong></p>
  
  <p>Error when get <code>Y-m-d</code> from <code>"SentTimestamp" : ISODate("2015-12-23T22:20:15Z")</code></p>
  
  <p><strong>DETAILS :</strong></p>
  
  <p><strong>document :</strong></p>
  
  <pre><code>{
  ...
  "SentTimestamp" : ISODate("2015-12-23T22:20:15Z")
  ...
  }
  </code></pre>
  
  <p><strong>query :</strong></p>
  
  <pre><code>db.foo.find({}, {$dateToString: {format:"%Y-%m-%d", date:"$SentTimestamp"}})
  </code></pre>
  
  <p><strong>Error :</strong></p>
  
  <pre><code>Error: error: {
      "$err" : "Can't canonicalize query: BadValue &gt;1 field in obj: { format: \"%Y-%m-%d\", date: \"$SentTimestamp\" }",
      "code" : 17287
  </code></pre>
  
  <p>Can somebody explain how can I convert date to string, what is wrong above ?</p>