| Class | Mongo::Grid::File::Info |
| In: |
lib/mongo/grid/file/info.rb
|
| Parent: | Object |
Encapsulates behavior around GridFS files collection file document.
@since 2.0.0
@deprecated Please use the ‘stream’ API on a FSBucket instead.
Will be removed in driver version 3.0.
| COLLECTION | = | 'files'.freeze |
Name of the files collection.
@since 2.0.0 |
|
| MAPPINGS | = | { :chunk_size => :chunkSize, :content_type => :contentType, :filename => :filename, :_id => :_id, :md5 => :md5, :length => :length, :metadata => :metadata, :upload_date => :uploadDate, :aliases => :aliases |
Mappings of user supplied fields to db specification.
@since 2.0.0 |
|
| DEFAULT_CONTENT_TYPE | = | 'binary/octet-stream'.freeze |
Default content type for stored files.
@since 2.0.0 |
| document | [R] | @return [ BSON::Document ] document The files collection document. |
Is this file information document equal to another?
@example Check file information document equality.
file_info == other
@param [ Object ] other The object to check against.
@return [ true, false ] If the objects are equal.
@since 2.0.0
Get the BSON type for a files information document.
@example Get the BSON type.
file_info.bson_type
@return [ Integer ] The BSON type.
@since 2.0.0
Get the file information content type.
@example Get the content type.
file_info.content_type
@return [ String ] The content type.
@since 2.0.0
Get a readable inspection for the object.
@example Inspect the file information.
file_info.inspect
@return [ String ] The nice inspection.
@since 2.0.0
Convert the file information document to BSON for storage.
@note If no md5 exists in the file information document (it was loaded
from the server and is not a new file) then we digest the md5 and set it.
@example Convert the file information document to BSON.
file_info.to_bson
@param [ BSON::ByteBuffer ] buffer The encoded BSON buffer to append to. @param [ true, false ] validating_keys Whether keys should be validated when serializing.
@return [ String ] The raw BSON data.
@since 2.0.0
Update the md5 hash if there is one.
@example Update the md5 hash.
file_info.update_md5(bytes)
@note This method is transitional and is provided for backwards compatibility. It will be removed when md5 support is deprecated entirely.
@param [ String ] The bytes to use to update the digest.
@return [ Digest::MD5 ] The md5 hash object.
@since 2.6.0
@deprecated as of 2.6.0