Method: Mongo::Grid#delete

Defined in:
lib/mongo/gridfs/grid.rb

#delete(id) ⇒ Boolean

Delete a file from the store.

Note that deleting a GridFS file can result in read errors if another process is attempting to read a file while it’s being deleted. While the odds for this kind of race condition are small, it’s important to be aware of.

Parameters:

  • []

    id

Returns:

  • (Boolean)


96
97
98
99
# File 'lib/mongo/gridfs/grid.rb', line 96

def delete(id)
  @files.remove({"_id" => id})
  @chunks.remove({"files_id" => id})
end