def write temp_object, opts={}
      content_type = opts[:content_type] || opts[:mime_type] || 'application/octet-stream'
      meta = temp_object.meta
      meta = meta.merge(opts[:meta]) if opts[:meta]

      grid_file = session.bucket.open(BSON::ObjectId.new, "w+")
      grid_file.content_type = content_type
      grid_file.metadata = meta
      grid_file.write(temp_object.data)
      grid_file._id
    end
def write temp_object, opts={}
      content_type = opts[:content_type] || opts[:mime_type] || 'application/octet-stream'
      meta = temp_object.meta
      meta = meta.merge(opts[:meta]) if opts[:meta]

      grid_file = session.bucket.open(BSON::ObjectId.new, "w+")
      grid_file.content_type = content_type
      grid_file.metadata = meta
      grid_file.write(temp_object.data)
      grid_file._id
    end
---------------------------------------------------------------------