struct Mongo::GridFS::File(FileID)

Overview

A GridFS file document.

Included Modules

Defined in:

cryomongo/gridfs.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.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)

[View source]

Class Method Detail

def self.from_bson(bson : BSON) #

NOTE See self.new.


[View source]

Instance Method Detail

def _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.


[View source]
def _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.


[View source]
def 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.


[View source]
def 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.


[View source]
def filename : String #

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


[View source]
def filename=(filename : String) #

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


[View source]
def length : Int64 #

The length of this stored file, in bytes.


[View source]
def length=(length : Int64) #

The length of this stored file, in bytes.


[View source]
def metadata : BSON | Nil #

Any additional application data the user wishes to store.


[View source]
def metadata=(metadata : BSON | Nil) #

Any additional application data the user wishes to store.


[View source]
def to_bson(bson = BSON.new) #

Converts to a BSON representation.

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

[View source]
def upload_date : Time #

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


[View source]
def upload_date=(upload_date : Time) #

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


[View source]