lib/bson/array.rb
# Get the array as encoded BSON.
#
# @example Get the array as encoded BSON.
#   [ 1, 2, 3 ].to_bson
#
# @note Arrays are encoded as documents, where the index of the value in
#   the array is the actual key.
#
# @return [ String ] The encoded string.
#
# @see http://bsonspec.org/#/specification
#
# @since 2.0.0
Get the array as encoded BSON.
Get the array as encoded BSON .
def to_bson(encoded = ''.force_encoding(BINARY))
      encode_with_placeholder_and_null(BSON_ADJUST, encoded) do |encoded|
        each_with_index do |value, index|
          encoded << value.bson_type
          index.to_bson_key(encoded)
          value.to_bson(encoded)
        end
      end
    end
def to_bson ( encoded = '' . force_encoding ( BINARY ) ) encode_with_placeholder_and_null ( BSON_ADJUST , encoded ) do | encoded | each_with_index do | value , index | encoded << value . bson_type index . to_bson_key ( encoded ) value . to_bson ( encoded ) end end end
Get the array as encoded BSON.
Get the array as encoded BSON .
The encoded string.
The encoded string .
 String 
encoded
force_encoding
example
Get the array as encoded BSON.
Get the array as encoded BSON .
note
Arrays are encoded as documents, where the index of the value in the array is the actual key.
Arrays are encoded as documents where the index of the value in the array is the actual key .
see
None
since
None