Method: Mongo::Grid::FSBucket#insert_one
- Defined in:
- lib/mongo/grid/fs_bucket.rb
#insert_one(file) ⇒ BSON::ObjectId
Deprecated.
Please use #upload_from_stream or #open_upload_stream instead. Will be removed in version 3.0.
Insert a single file into the GridFS.
175 176 177 178 179 180 |
# File 'lib/mongo/grid/fs_bucket.rb', line 175 def insert_one(file) @indexes ||= ensure_indexes! chunks_collection.insert_many(file.chunks) files_collection.insert_one(file.info) file.id end |