NAME

Mongol::Cursor - Object cursor

SYNOPSIS

package Person {
	use Moose;

	extends 'Mongol::Base';

	with 'Mongol::Entity';

	has 'name' => (
		is => 'ro',
		isa => 'Str',
		required => 1,
	);

	has 'age' => (
		is => 'ro',
		isa => 'Int',
		required => 1,
	);

	__PACKAGE__->meta()->make_immutable();
}

my $cursor = Person->find( { age => { '$lt' => 30 } } );
while( ( my $person = $cursor->next() ) ) {
	printf( "Name: %s\n", $person->name() );
	printf( "Age: %d\n", $person->age() );
}

my @people = $cursor->all();

DESCRIPTION

METHODS

all

my @objects = $cursor->all();

Returns an array of entities.

has_next

my $bool = $cursor->has_next();

Checks if there are any more objects in the cursor.

next

my $object = $cursor->next();

Returns the next entity in the cursor. If the cursor has no more values undef will be returned.

SEE ALSO