struct

Mongo::GridFS::File(FileID)

Inherits BSON::Serializable / Struct / Value / Object

A GridFS file document.

Constructors

new(bson : BSON)

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)
Source

Class methods

from_bson(bson : BSON)

NOTE: See self.new.

Source

Instance methods

_id

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.

Source
_id=(_id : FileID)

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.

Source
chunk_size

The size, in bytes, of each data chunk of this file. This value is configurable by file. The default is 255 KiB.

Source
chunk_size=(chunk_size : Int64)

The size, in bytes, of each data chunk of this file. This value is configurable by file. The default is 255 KiB.

Source
filename

The name of this stored file; this does not need to be unique.

Source
filename=(filename : String)

The name of this stored file; this does not need to be unique.

Source
length

The length of this stored file, in bytes.

Source
length=(length : Int64)

The length of this stored file, in bytes.

Source
metadata

Any additional application data the user wishes to store.

Source
metadata=(metadata : BSON | Nil)

Any additional application data the user wishes to store.

Source
to_bson(bson = BSON.new)

Converts to a BSON representation.

user = User.new name: "John"
bson = user.to_bson
Source
upload_date

The date and time this file was added to GridFS, stored as a BSON datetime value.

Source
upload_date=(upload_date : Time)

The date and time this file was added to GridFS, stored as a BSON datetime value.

Source