struct

DynFork::Migration::ModelState

Inherits BSON::Serializable < Struct < Value < Object

For control state of Model in the super collection.

Constructors

new(collection_name : String, field_name_and_type_list : Hash(String, String), data_dynamic_fields : Hash(String, String), model_exists : Bool = false)
Source
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

collection_name
Source
data_dynamic_fields
Source
data_dynamic_fields=(data_dynamic_fields : Hash(String, String))
Source
field_name_and_type_list
Source
field_name_and_type_list=(field_name_and_type_list : Hash(String, String))
Source
model_exists=(model_exists : Bool)
Source
model_exists?
Source
to_bson(bson = BSON.new)

Converts to a BSON representation.

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