How to get sum of differences from two dates in mongodb
<p>I want to sum of differences from starttime and endtime in minutes.</p>
<pre><code>{
    &quot;_id&quot; : ObjectId(&quot;56cd544df7851e850d8b4573&quot;),
    &quot;user_id&quot; : &quot;281&quot;,
    &quot;document_id&quot; : &quot;1455614372.pdf&quot;,
    &quot;page_number&quot; : &quot;1&quot;,
    &quot;starttime&quot; : ISODate(&quot;48118-03-20T01:35:14Z&quot;),
    &quot;endtime&quot; : ISODate(&quot;48118-03-20T04:29:10Z&quot;)
}
{
    &quot;_id&quot; : ObjectId(&quot;56cd544df7851e850d8b4574&quot;),
    &quot;user_id&quot; : &quot;281&quot;,
    &quot;document_id&quot; : &quot;1455614372.pdf&quot;,
    &quot;page_number&quot; : &quot;1&quot;,
    &quot;starttime&quot; : ISODate(&quot;48118-03-20T14:29:49Z&quot;),
    &quot;endtime&quot; : ISODate(&quot;48118-06-22T12:52:36Z&quot;)
}
{
    &quot;_id&quot; : ObjectId(&quot;56cd544df7851e850d8b4575&quot;),
    &quot;user_id&quot; : &quot;281&quot;,
    &quot;document_id&quot; : &quot;1455614372.pdf&quot;,
    &quot;page_number&quot; : &quot;2&quot;,
    &quot;starttime&quot; : ISODate(&quot;48118-03-20T04:29:10Z&quot;),
    &quot;endtime&quot; : ISODate(&quot;48118-03-20T14:29:49Z&quot;)
}
</code></pre>
<p>my collection name is pdftracker.</p>