NAME

MongoDBx::Class::Cursor - A MongoDBx::Class cursor/iterator object for query results

VERSION

version 1.03

EXTENDS

MongoDB::Cursor

SYNOPSIS

my $cursor = $coll->find({ author => 'Conan Doyle' });

print "Novels by Arthur Conan Doyle:\n";

foreach ($cursor->sort({ year => 1 })->all) {
	print $_->title, '( ', $_->year, ")\n";
}

DESCRIPTION

MongoDBx::Class::Cursor extends MongoDB::Cursor. At its basis, it adds automatic document expansion when traversing cursor results.

ATTRIBUTES

No special attributes are added.

OBJECT METHODS

Aside from methods provided by MonogDB::Cursor, the following method modifications are performed:

next( [ $do_not_expand ] )

Returns the next document in the cursor, if any. Automatically expands that document to the appropriate class (if '_class' attribute exists, otherwise document is returned as is). If $do_not_expand is true, the document will not be expanded and simply returned as is (i.e. as a hash-ref).

sort( $rules )

Adds a sort to the cursor and returns the cursor itself for chaining. $rules can either be an unordered hash-ref, an ordered Tie::IxHash object, or an ordered array reference such as this:

$cursor->sort([ date => -1, time => -1, subject => 1 ])

AUTHOR

Ido Perlmuter, <ido at ido50.net>

BUGS

Please report any bugs or feature requests to bug-mongodbx-class at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MongoDBx-Class. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc MongoDBx::Class::Cursor

You can also look for information at:

SEE ALSO

MongoDBx::Class::Collection, MongoDB::Cursor.

LICENSE AND COPYRIGHT

Copyright 2010-2012 Ido Perlmuter.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.