Skip to content
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.

add MongoDB::Collection::get_collection method #52

Merged
merged 1 commit into from May 21, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion lib/MongoDB/Collection.pm
Expand Up @@ -98,7 +98,23 @@ sub AUTOLOAD {
my $coll = $AUTOLOAD;
$coll =~ s/.*:://;

carp sprintf q{AUTOLOADed collection method names are deprecated and will be removed in a future release. Use $db->get_collection( '%s' ) instead.}, $coll;
carp sprintf q{AUTOLOADed collection method names are deprecated and will be removed in a future release. Use $collection->get_collection( '%s' ) instead.}, $coll;

return $self->get_collection($coll);
}

=head2 get_collection ($name)

my $collection = $database->get_collection('foo');

Returns a L<MongoDB::Collection> for the collection called C<$name> within this
collection.

=cut

sub get_collection {
my $self = shift @_;
my $coll = shift @_;

return $self->_database->get_collection($self->name.'.'.$coll);
}
Expand Down