b action { my $self = shift(); my $mongo = $self->mongodb(); ... return $self->render( json => undef ); } Just in case you need access to the MongoDB client instance you can use this help