def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
      buffer.put_bytes(generate_data)
    end
def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
      buffer.put_bytes(generate_data)
    end
Get the object id as it's raw BSON data.

 @example Get the raw bson bytes.
   object_id.to_bson

 @note Since Moped's BSON and MongoDB BSON before 2.0.0 have different
   internal representations, we will attempt to repair the data for cases
   where the object was instantiated in a non-standard way. (Like a
   Marshal.load)

 @return [ BSON::ByteBuffer ] The buffer with the encoded object.

 @see http://bsonspec.org/#/specification

 @since 2.0.0