title: PHP MongoDB - Use of the aggregate command without the cursor option is deprecated. What?
body: <p>I have updated mongo and now in the log the following error appears:
  <strong>Use of the aggregate command without the cursor option is deprecated</strong></p>
  
  <p><strong>Mongo says that I should put a second REQUIRED parameter to aggregate function, because my current usage is deprecated.</strong></p>
  
  <p>I currently use the following code PHP (now is deprecated):</p>
  
  <pre><code>$this-&gt;db-&gt;{$collection}-&gt;aggregate($options);
  </code></pre>
  
  <p>And return this format:</p>
  
  <pre><code>{"result":[
      {
      "_id":"xxxxxx",
      "update":[
      {
      "firstUpdateTime":xxxxxx,
      "updateTime":xxxxxxx,
      }
      ],
      "media":[
      {
      "xxxx":{ ...
  </code></pre>
  
  <p><strong>To not use an deprecated code I add the new second parameter (but I do not understand what to put):</strong></p>
  
  <pre><code>$this-&gt;db-&gt;{$collection}-&gt;aggregate($options, array('cursor' =&gt; array('batchSize' =&gt; 101)));
  </code></pre>
  
  <p>And this returns the same information but varies the initial structure:</p>
  
  <pre><code>{"cursor":{
  "id":{
  "value":"xxxxxx"
  },
  "ns":"xxxxxx.instagram",
  "firstBatch":[
  {
  "_id":"xxxxxx",
  "update":[
  {
  "firstUpdateTime":xxxxxx,
  "updateTime":xxxxxx,
  }
  ],
  "media":[
  {
  "xxxxxx":{ ...
  </code></pre>
  
  <p>After the update Mongo forces me to change the way I read the data. 
  I don't understand what value I should put in that second parameter called "cursor"...</p>
  
  <p><strong>What should I put in that second parameter?
  Can I set a default value without altering the structure of results?</strong></p>
  
  <p>Doc: 
  <a href="https://docs.mongodb.com/manual/reference/method/db.collection.aggregate/" rel="noreferrer">https://docs.mongodb.com/manual/reference/method/db.collection.aggregate/</a>
  <a href="http://php.net/manual/es/mongocollection.aggregate.php" rel="noreferrer">http://php.net/manual/es/mongocollection.aggregate.php</a></p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>If I indicate the cursor in the function I no longer receive the error.
  But without applying to the solution, I read the LOG and the warning appears at random, I have a code that I run several times and sometimes if it reports the mentioned warning and others do not.</p>
  
  <p>Why?</p>