NAME
Mandel::Model - An object modelling a document
DESCRIPTION
This class is used to descrieb the structure of document in mongodb.
ATTRIBUTES
collection_name
The name of the collection in the database. Default is the plural form of "name".
collection_class
The class name of the collection class. This default to Mandel::Collection.
document_class
The class name of the document this description is attached to. Default to an autogenerated class name.
name
The name of this model. Same as given to "model" in Mandel and "collection" in Mandel.
METHODS
field
$self = $self->field('name', %args);
$self = $self->field(['name1', 'name2'], %args);
Used to define new field(s) to the document.
relationship
$rel_obj = $self->relationship($type => $field_name => 'Other::Document::Class');
$rel_obj = $self->relationship($field_name);
This method is used to describe a relationship between two documents.
See Mandel::Relationship::BelongsTo, Mandel::Relationship::HasMany or Mandel::Relationship::HasOne.
new_collection
$self->new_collection($connection);
Returns a new instance of "collection_class".
SEE ALSO
AUTHOR
Jan Henning Thorsen - jhthorsen@cpan.org