How would I call the id by itself?
Array
(
[0] => Array
(
[_id] => MongoId Object
(
[$id] => 4f98930cb1445d0a7d000001
)
)
)
I thought it would be:
echo $userInfo[0]['_id']->['$id'];
As _id is a MongoId object, you should access it's public members like this:
echo $userInfo[0]['_id']->id;
EDIT: The MongoId $id field starts with a dollar sign so you may have to call it by {'$id'}, else PHP won't parse it correctly. (thanks @cKendrick)
echo $userInfo[0]['_id']->{'$id'};