Class Mongo::Grid::File
In: lib/mongo/grid/file/chunk.rb
lib/mongo/grid/file/info.rb
lib/mongo/grid/file.rb
Parent: Object

A representation of a file in the database.

@since 2.0.0

@deprecated Please use the ‘stream’ API on a FSBucket instead.

  Will be removed in driver version 3.0.

Methods

==   data   inspect   new  

Classes and Modules

Class Mongo::Grid::File::Chunk
Class Mongo::Grid::File::Info

Attributes

chunks  [R]  @return [ Array<Chunk> ] chunks The file chunks.
info  [R]  @return [ File::Info ] info The file information.

Public Class methods

Initialize the file.

@example Create the file.

  Grid::File.new(data, :filename => 'test.txt')

@param [ IO, String, Array<BSON::Document> ] data The file object, file

  contents or chunks.

@param [ BSON::Document, Hash ] options The info options.

@option options [ String ] :filename Required name of the file. @option options [ String ] :content_type The content type of the file.

  Deprecated, please use the metadata document instead.

@option options [ String ] :metadata Optional file metadata. @option options [ Integer ] :chunk_size Override the default chunk

  size.

@option opts [ Array<String> ] :aliases A list of aliases.

  Deprecated, please use the metadata document instead.

@since 2.0.0

Public Instance methods

Check equality of files.

@example Check the equality of files.

  file == other

@param [ Object ] other The object to check against.

@return [ true, false ] If the objects are equal.

@since 2.0.0

Joins chunks into a string.

@return [ String ] The raw data for the file.

@since 2.0.0

Gets a pretty inspection of the file.

@example Get the file inspection.

  file.inspect

@return [ String ] The file inspection.

@since 2.0.0

[Validate]