AnyMongo

 view release on metacpan or  search on metacpan

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

    my $db = $self->_database->name;

    my $last_error = Tie::IxHash->new(getlasterror => 1, w => $conn->w, wtimeout => $conn->wtimeout);
    my $request_id = AnyMongo::MongoSupport::make_request_id();
    my $query = AnyMongo::MongoSupport::build_query_message(
        $request_id, $db.'.$cmd', 0, 0, -1, $last_error);
    # $conn->recv($cursor);
    $conn->send_message("$req$query");

    my ($number_received,$cursor_id,$result) = $conn->recv_message();
    # use Data::Dumper;
    # warn "_make_safe getlasterror number_received:$number_received cursor_id:$cursor_id result=> ".Dumper($result);

    if ( $number_received == 1 ) {
        my $ok = $result->[0];
        # $result->{ok} is 1 if err is set
        Carp::croak $ok->{err} if $ok->{err};
        # $result->{ok} == 0 is still an error
        if (!$ok->{ok}) {
            Carp::croak $ok->{errmsg};
        }

lib/AnyMongo/Connection.pm  view on Meta::CPAN

    OP_DELETE	=> 2006, #Delete documents
    OP_KILL_CURSORS  => 2007,
    # flags
    REPLY_CURSOR_NOT_FOUND     => 1,
    REPLY_QUERY_FAILURE        => 2,
    REPLY_SHARD_CONFIG_STALE   => 4,
    REPLY_AWAIT_CAPABLE        => 8,
};

use Carp qw(croak);
use Data::Dumper;
use AnyEvent::Socket;
use AnyEvent::Handle;
use AnyMongo::BSON qw(bson_decode);
use AnyMongo::MongoSupport qw(decode_bson_documents);
use AnyMongo::Cursor;
use namespace::autoclean;
use Any::Moose;

has find_master => (
    is       => 'ro',

t/bson.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More tests => 2;
use Test::Deep;
use Data::Dumper;
use Devel::Peek;
use boolean;
use AnyMongo::BSON qw(bson_encode bson_decode);

{
    my $data = {
    i => 1,
    's' => 'test',
    'i' => 10,
    'f' => 1.1,

t/perl-driver-api/collection.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More;
use Test::Exception;
use Data::Dumper;
use Data::Types qw(:float);
use Tie::IxHash;
use Encode qw(encode decode);

use AnyMongo::Compat;

my $conn;
eval {
    my $host = "localhost";
    if (exists $ENV{MONGOD}) {

t/perl-driver-api/types.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More;
use Test::Exception;
use AnyMongo::Compat;
use DateTime;
use JSON;
use Data::Dumper;

my $conn;
eval {
    my $host = "localhost";
    if (exists $ENV{MONGOD}) {
        $host = $ENV{MONGOD};
    }
    $conn = MongoDB::Connection->new(host => $host);
};

t/rs.pl  view on Meta::CPAN

use strict;
use warnings;
use AnyMongo;
use boolean;
use Data::Dumper;
use Devel::Peek;
use Data::Dump;

my $m = AnyMongo->new_connection(host => "mongodb://localhost:27018", find_master => 1);

my $db = $m->get_database("admin");
my $c = $db->get_collection("bar");

while (true) {
#   print "finding...";



( run in 0.278 second using v1.01-cache-2.11-cpan-4d50c553e7e )