Mandel::Model - An object modelling a document
This class is used to descrieb the structure of document in mongodb.
The name of the collection in the database. Default is the plural form of "name".
The class name of the collection class. This default to Mandel::Collection.
The class name of the document this description is attached to. Default to an autogenerated class name.
The name of this model. Same as given to "model" in Mandel and "collection" in Mandel.
$field_obj = $self->field('name'); $self = $self->field(name => \%meta); $self = $self->field(['name1', 'name2'], \%meta);
Used to define new field(s) or retrieve a defined Mandel::Model::Field object.
@fields = $self->fields;
Get list of Mandel::Model::Field objects in the order they were added to thie model.
$rel_obj = $self->relationship($type => $accessor => 'Other::Document::Class', %args); $rel_obj = $self->relationship($accessor);
This method is used to describe a relationship between two documents.
See Mandel::Relationship::BelongsTo, Mandel::Relationship::HasMany or Mandel::Relationship::HasOne.
$accessor will be used as l<Mandel::Relationship/accessor>, "Other::Document::Class" will be used as "related_class" in Mandel::Relationship and Mandel::Model/document_class will be used as "document_class" in Mandel::Relationship.
$accessor
Mandel::Model/document_class
%args is passed on the the relationship constructor.
%args
$self->new_collection($connection);
Returns a new instance of "collection_class".
Mojolicious, Mango, Mandel
Jan Henning Thorsen - jhthorsen@cpan.org
jhthorsen@cpan.org
To install Mandel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mandel
CPAN shell
perl -MCPAN -e shell install Mandel
For more information on module installation, please visit the detailed CPAN module installation guide.