Meerkat

 view release on metacpan or  search on metacpan

lib/Meerkat/Collection.pm  view on Meta::CPAN

        $self->_sync( $data => $obj );
        $obj->_set_removed(0);
        return 1;
    }
    else {
        $obj->_set_removed(1);
        return; # false means removed
    }
}

sub update {
    state $check = compile( Object, Object, HashRef );
    my ( $self, $obj, $update ) = $check->(@_);
    my $data = $self->_try_mongo_op(
        update => sub {
            $self->_mongo_collection->find_one_and_update( { _id => $obj->_id },
                $update, { returnDocument => "after" } );
        },
    );

    if ( ref $data ) {

lib/Meerkat/Role/Document.pm  view on Meta::CPAN

#pod This command is intended for custom updates with unusual logic or operators.
#pod Many typical updates can be accomplished with the C<update_*> methods described
#pod below.
#pod
#pod For all update methods, you can use a MongoDB nested field label to modify
#pod values deep into a data structure. For example C<parents.father> refers to
#pod C<< $obj->parents->{father} >>.
#pod
#pod =cut

sub update {
    state $check = compile( Object, HashRef );
    my ( $self, $update ) = $check->(@_);
    croak "The update method only accepts MongoDB update operators"
      if grep { /^[^\$]/ } keys %$update;
    return if $self->is_removed; # NOP
    return $self->_collection->update( $self, $update );
}

#pod =method update_set
#pod

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.201 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )