title: Mongodb generate row number with find query
body: <p>I have the following documents in mongo collection:</p>
  
  <pre><code>{name: "Test1", "date" : "2014-09-01"},
  {name: "Test2", "date" : "2014-08-01"}
  {name: "Test3", "date" : "2014-07-01"}
  {name: "Test4", "date" : "2014-06-01"}
  {name: "Test5", "date" : "2014-05-01"}
  {name: "Test6", "date" : "2014-04-01"}
  </code></pre>
  
  <p>I am issuing an aggregate query on mongo (using java) to find the documents between particular dates. The output of the query looks like this:</p>
  
  <pre><code>{name : Test3},
  {name : Test4}
  </code></pre>
  
  <p>In this output, I want to have a row_number which should start from 0 and should have unique value, like Oracle's rownum. Is it possible in mongo?</p>
  
  <p>Thanks.</p>