Method: Mongo::Grid::File::Info#to_bson
- Defined in:
- lib/mongo/grid/file/info.rb
#to_bson(buffer = BSON::ByteBuffer.new, validating_keys = nil) ⇒ String
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.
Convert the file information document to BSON for storage.
236 237 238 239 240 241 |
# File 'lib/mongo/grid/file/info.rb', line 236 def to_bson(buffer = BSON::ByteBuffer.new, validating_keys = nil) if @client_md5 && !document[:md5] document[:md5] = @client_md5.hexdigest end document.to_bson(buffer) end |