Method: Mongo::Grid::File::Chunk#to_bson

Defined in:
lib/mongo/grid/file/chunk.rb

#to_bson(buffer = BSON::ByteBuffer.new, validating_keys = nil) ⇒ String

Conver the chunk to BSON for storage.

Examples:

Convert the chunk to BSON.

chunk.to_bson

Parameters:

  • buffer (BSON::ByteBuffer) (defaults to: BSON::ByteBuffer.new)

    The encoded BSON buffer to append to.

  • validating_keys (true, false) (defaults to: nil)

    Whether keys should be validated when serializing. This option is deprecated and will not be used. It will removed in version 3.0.

Returns:

  • (String)

    The raw BSON data.

Since:

  • 2.0.0



141
142
143
# File 'lib/mongo/grid/file/chunk.rb', line 141

def to_bson(buffer = BSON::ByteBuffer.new, validating_keys = nil)
  document.to_bson(buffer)
end