The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mandel::Relationship::HasMany - A field relates to many other mongodb document

DESCRIPTION

Using DSL from Mandel::Document:

  package MyModel::Cat;
  use Mandel::Document;
  has_many owners => 'MyModel::Person';

Using object oriented interface:

  MyModel::Cat
    ->model
    ->relationship(has_many => owners => 'MyModel::Person');

Will add:

  $cat = MyModel::Cat->new->add_owners(\%args, $cb);
  $cat = MyModel::Cat->new->add_owners($person_obj, $cb);

  $person_obj = MyModel::Cat->new->add_owners(\%args);
  $person_obj = MyModel::Cat->new->add_owners($person_obj);

  $persons = MyModel::Cat->new->search_owners;

  $person_objs = MyModel::Cat->new->owners;
  $self = MyModel::Cat->new->owners(sub {
    my($self, $err, $person_objs) = @_;
  });

See also "relationship" in Mandel::Model.

ATTRIBUTES

add_method_name

The name of the method used to add another document to the .

search_method_name

The name of the method used to search related documents.

METHODS

monkey_patch

Add methods to "document_class" in Mandel::Relationship.

SEE ALSO

Mojolicious, Mango, Mandel::Relationship

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org