def decode_iter(data, codec_options=DEFAULT_CODEC_OPTIONS):
 if (not isinstance(codec_options, CodecOptions)):
  raise _CODEC_OPTIONS_TYPE_ERROR
 position = 0
 end = (len(data) - 1)
 while (position < end):
  obj_size = _UNPACK_INT(data[position:(position + 4)])[0]
  elements = data[position:(position + obj_size)]
  position += obj_size
  (yield _bson_to_dict(elements, codec_options))

def decode_iter ( data , codec_options = DEFAULT_CODEC_OPTIONS ) : if ( not isinstance ( codec_options , CodecOptions ) ) : raise _CODEC_OPTIONS_TYPE_ERROR position = 0 end = ( len ( data ) - 1 ) while ( position < end ) : obj_size = _UNPACK_INT ( data [ position : ( position + 4 ) ] ) [ 0 ] elements = data [ position : ( position + obj_size ) ] position += obj_size ( yield _bson_to_dict ( elements , codec_options ) )
decode bson data to multiple documents as a generator .