Mongoose::Class - sugary Mongoose-oriented replacement for Moose
version 0.04
package MySchema::Person; use Mongoose::Class; # uses Moose for you with 'Mongoose::Document'; has 'name' => ( is=>'rw', isa=>'Str' ); has_many 'siblings' => ( is=>'rw', isa=>'Person' ); belongs_to 'club' => ( is=>'rw', isa=>'Club' ); has_one 'father' => ( is=>'rw', isa=>'Person' );
This is very much a work-in-progress.
Basically, this module adds some sugar into your Mongoose Document class by defining some stand-in replacements for Moose's own has.
has
has_many has_one belongs_to
The idea: fewer keystrokes and improved readability by self-documenting your class.
Does nothing. It's the same as using has.
Wraps the defined relationship with another class using Mongoose::Join.
Mongoose::Join
This:
has_many 'employees' => ( isa=>'Employee' ); # or has_manu 'employees' => 'Employee';
Becomes this:
has 'employees' => ( is => 'ro', isa => 'Mongoose::Join[Employee]', default => sub { Mongoose::Join->new( with_class=>'Employee' ) } );
To install Mongoose, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mongoose
CPAN shell
perl -MCPAN -e shell install Mongoose
For more information on module installation, please visit the detailed CPAN module installation guide.