struct Mongo::GridFS::File(FileID)
- Mongo::GridFS::File(FileID)
- Struct
- Value
- Object
Overview
A GridFS file document.
Included Modules
- BSON::Serializable
Defined in:
cryomongo/gridfs.crConstructors
-
.new(bson : BSON)
Allocate an instance and copies data from a BSON struct.
Class Method Summary
-
.from_bson(bson : BSON)
NOTE See
self.new
.
Instance Method Summary
-
#_id : FileID
A unique ID for this document.
-
#_id=(_id : FileID)
A unique ID for this document.
-
#chunk_size : Int64
The size, in bytes, of each data chunk of this file.
-
#chunk_size=(chunk_size : Int64)
The size, in bytes, of each data chunk of this file.
-
#filename : String
The name of this stored file; this does not need to be unique.
-
#filename=(filename : String)
The name of this stored file; this does not need to be unique.
-
#length : Int64
The length of this stored file, in bytes.
-
#length=(length : Int64)
The length of this stored file, in bytes.
-
#metadata : BSON?
Any additional application data the user wishes to store.
-
#metadata=(metadata : BSON?)
Any additional application data the user wishes to store.
-
#to_bson(bson = BSON.new)
Converts to a BSON representation.
-
#upload_date : Time
The date and time this file was added to GridFS, stored as a BSON datetime value.
-
#upload_date=(upload_date : Time)
The date and time this file was added to GridFS, stored as a BSON datetime value.
Constructor Detail
Allocate an instance and copies data from a BSON struct.
class User
include BSON::Serializable
property name : String
end
data = BSON.new
data["name"] = "John"
User.new(data)
Class Method Detail
Instance Method Detail
A unique ID for this document. Usually this will be of type ObjectId, but a custom _id value provided by the application may be of any type.
A unique ID for this document. Usually this will be of type ObjectId, but a custom _id value provided by the application may be of any type.
The size, in bytes, of each data chunk of this file. This value is configurable by file. The default is 255 KiB.
The size, in bytes, of each data chunk of this file. This value is configurable by file. The default is 255 KiB.
Converts to a BSON representation.
user = User.new name: "John"
bson = user.to_bson
The date and time this file was added to GridFS, stored as a BSON datetime value.
The date and time this file was added to GridFS, stored as a BSON datetime value.