views:

17

answers:

0

Im having serious issues converting mongo id from object to string. The following code

$cursor = $connection->mydb->collectn->findOne();  
var_dump($cursor['_id'].'');  
var_dump((string) $cursor['_id']);

returns string(12) "Object id #6" while what I was expecting is a textual representation of the hex digits of the id. It however works perfectly locally on my pc. What could be wrong?