title: MongoDB divide returns null when dividing by other variable
body: <p>I am trying to compute some numbers, but MongoDB returns null when using previous computed variable in $divide operator</p>
  
  <p>This is the query:</p>
  
  <pre><code>db.apps.aggregate(
  
  {$project : {
      a: {$multiply : [2,2]},
      b: {$divide: [5, "$a"]},
      c: {$divide: [5, 4]}
  
  }})
  </code></pre>
  
  <p>Why "b" is null in the result:</p>
  
  <pre><code>/* 0 */
  {
      "result" : [ 
          {
              "_id" : ObjectId("5361173d93861f6e5239714e"),
              "a" : 4,
              "b" : null,
              "c" : 1.25
          }, 
          {
              "_id" : ObjectId("536192c1938652d039fa0051"),
              "a" : 4,
              "b" : null,
              "c" : 1.25
          }
      ],
      "ok" : 1
  }
  </code></pre>
  
  <p><strong>EDIT:
  Thanks to Neil comment, the solution is to have second stage $project</strong></p>
  
  <pre><code>db.apps.aggregate(
  
  {$project : {
      a: {$multiply : [2,2]},
      b: {$divide: [5, "$a"]},
      c: {$divide: [5, 4]}
  
  }},
  
  
  {$project : {
      a: 1, c:1,
      b: {$divide: [5, "$a"]},   
  }}
  
  )
  </code></pre>