AnyMongo
view release on metacpan or search on metacpan
lib/AnyMongo/Collection.pm view on Meta::CPAN
return 0;
}
else {
die $@;
}
}
return $obj->{n};
}
sub validate {
my ($self, $scan_data) = @_;
$scan_data = 0 unless defined $scan_data;
my $obj = $self->_database->run_command({ validate => $self->name });
}
sub drop_indexes {
my ($self) = @_;
return $self->drop_index('*');
}
sub drop_index {
my ($self, $index_name) = @_;
my $t = tie(my %myhash, 'Tie::IxHash');
t/perl-driver-api/collection.t view on Meta::CPAN
my $obj = $coll->find_one;
is($obj->{mongo} => 'hacker', 'find_one');
is(ref $obj->{with}, 'HASH', 'find_one type');
is($obj->{with}->{a}, 'reference');
is(ref $obj->{and}, 'ARRAY');
is_deeply($obj->{and}, [qw/an array reference/]);
ok(!exists $obj->{perl});
is($obj->{just}, "an\xE4oth\0er");
lives_ok {
$coll->validate;
} 'validate';
$coll->remove($obj);
is($coll->count, 0, 'remove() deleted everything (won\'t work on an old version of Mongo)');
$coll->drop;
for (my $i=0; $i<10; $i++) {
$coll->insert({'x' => $i, 'z' => 3, 'w' => 4});
$coll->insert({'x' => $i, 'y' => 2, 'z' => 3, 'w' => 4});
}
( run in 0.277 second using v1.01-cache-2.11-cpan-a5abf4f5562 )