Hello everyone I use MongoDB find() method like this:
$cursor = $collection->find();
foreach($cursor as $doc) {
// do something....
}
it’s ok but my _id property is autogenereted so when I use code above $doc[_id] is Object but I need a string.
How can I convert it to string automatically. Not like this:
foreach($cursor as $doc) {
$doc['_id'] = (string)$doc['_id'];
}
Handling mongoid properly by
json_encodeused to be a bug in the php driver. It should be fixed since v1.0.11.