title: MongoDB: ObjectId to String
body: <p>Hello everyone I use MongoDB find() method like this:</p>
  
  <pre><code>$cursor = $collection-&gt;find();
  foreach($cursor as $doc) {
     // do something....
  }
  </code></pre>
  
  <p>it's ok but my _id property is autogenereted so when I use code above $doc[_id] is Object but I need a string. </p>
  
  <p>How can I convert it to string automatically. Not like this:</p>
  
  <pre><code>foreach($cursor as $doc) {      
      $doc['_id'] = (string)$doc['_id'];
  }
  </code></pre>