This is already taken care of in mongo_io_recv_*() in mcon, and in the PHP Streams implementation