What does $sum:1 mean in Mongo
<p>I have a collection <code>foo</code>:</p>

<pre><code>{ "_id" : ObjectId("5837199bcabfd020514c0bae"), "x" : 1 }
{ "_id" : ObjectId("583719a1cabfd020514c0baf"), "x" : 3 }
{ "_id" : ObjectId("583719a6cabfd020514c0bb0") }
</code></pre>

<p>I use this query:</p>

<pre><code>db.foo.aggregate({$group:{_id:1, avg:{$avg:"$x"}, sum:{$sum:1}}})
</code></pre>

<p>Then I get a result:</p>

<blockquote>
<pre><code>{ "_id" : 1, "avg" : 2, "sum" : 3 }
</code></pre>
</blockquote>

<p>What does <code>{$sum:1}</code> mean in this query?</p>