| 1 | package Mongoose::EmbeddedDocument; | ||
| 2 | 1 | $Mongoose::EmbeddedDocument::VERSION = '2.02'; | |
| 3 | 1 | ▶ | use MooseX::Role::Parameterized; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use Mongoose::Meta::AttributeTraits; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | parameter '-engine' => ( isa => 'Mongoose::Role::Engine' ); | |
| 7 | 1 | parameter '-pk' => ( isa => 'ArrayRef[Str]' ); | |
| 8 | |||
| 9 | 1 | ▶ | role { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 10 | 1 | my $p = shift; | |
| 11 | 1 | with 'Mongoose::Document' => $p; | |
| 12 | 1 | }; | |
| 13 | |||
| 14 | =head1 NAME | ||
| 15 | |||
| 16 | Mongoose::EmbeddedDocument - role for embedded documents | ||
| 17 | |||
| 18 | =head1 SYNOPSIS | ||
| 19 | |||
| 20 | package Address; | ||
| 21 | use Moose; | ||
| 22 | with 'Mongoose::EmbeddedDocument'; | ||
| 23 | has 'street' => is=>'rw', isa=>'Str'; | ||
| 24 | |||
| 25 | package Person; | ||
| 26 | use Moose; | ||
| 27 | with 'Mongoose::Document'; | ||
| 28 | has 'address' => ( is=>'rw', isa=>'Address' ); | ||
| 29 | |||
| 30 | =head1 DESCRIPTION | ||
| 31 | |||
| 32 | This role is a copy of C<Mongoose::Document>, but flags the class | ||
| 33 | as 'embedded' so that it's collapsed into a single parent document | ||
| 34 | in the database. | ||
| 35 | |||
| 36 | =head1 SEE ALSO | ||
| 37 | |||
| 38 | Read the Mongoose intro or cookbook. | ||
| 39 | |||
| 40 | From the MongoDB docs: L<http://www.mongodb.org/display/DOCS/Updating+Data+in+Mongo#UpdatingDatainMongo-EmbeddingDocumentsDirectlyinDocuments> | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | 1 | 1; | |