This documentation seems to be obsolete because I tried the first example and it doesn't convert the objectId to a string.
This seems to be more current documentation but I can't figure out how to get bson to json
http://mongodb.github.io/mongo-php-library/api/source-class-MongoDB.Model.BSONDocument.html#48-57