Although bson_to_zval() never completely supported decoding of multiple BSON documents from a large stream, it's a handy feature for processing input streams or reading BSON dump files.
We can create an iterator class that abstracts libbson's reader structure and emits documents when iterated upon, similar to the BsonIterator class I created for my react-mongodb project.