Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Mango::Cursor::Query(3User Contributed Perl DocumentatiMango::Cursor::Query(3)

NAME
       Mango::Cursor::Query - MongoDB query cursor

SYNOPSIS
	 use Mango::Cursor::Query;

	 my $cursor = Mango::Cursor::Query->new(collection => $collection);
	 my $docs   = $cursor->all;

DESCRIPTION
       Mango::Cursor::Query is a container for MongoDB query cursors used by
       Mango::Collection.

ATTRIBUTES
       Mango::Cursor::Query inherits all attributes from Mango::Cursor and
       implements the following	new ones.

   await_data
	 my $await = $cursor->await_data;
	 $cursor   = $cursor->await_data(1);

       Await data.

   comment
	 my $comment = $cursor->comment;
	 $cursor     = $cursor->comment('Fun query!');

       A comment to identify query.

   fields
	 my $fields = $cursor->fields;
	 $cursor    = $cursor->fields({foo => 1});

       Select fields from documents.

   hint
	 my $hint = $cursor->hint;
	 $cursor  = $cursor->hint({foo => 1});

       Force a specific	index to be used.

   max_scan
	 my $max = $cursor->max_scan;
	 $cursor = $cursor->max_scan(500);

       Limit the number	of documents to	scan.

   max_time_ms
	 my $max = $cursor->max_time_ms;
	 $cursor = $cursor->max_time_ms(500);

       Timeout for query in milliseconds.

   query
	 my $query = $cursor->query;
	 $cursor   = $cursor->query({foo => 'bar'});

       Original	query.

   read_preference
	 my $pref = $cursor->read_preference;
	 $cursor  = $cursor->read_preference({mode => 'SECONDARY'});

       Read preference.

   skip
	 my $skip = $cursor->skip;
	 $cursor  = $cursor->skip(5);

       Number of documents to skip, defaults to	0.

   snapshot
	 my $snapshot =	$cursor->snapshot;
	 $cursor      =	$cursor->snapshot(1);

       Use snapshot mode.

   sort
	 my $sort = $cursor->sort;
	 $cursor  = $cursor->sort({foo => 1});
	 $cursor  = $cursor->sort(bson_doc(foo => 1, bar => -1));

       Sort documents, the order of keys matters.

   tailable
	 my $tailable =	$cursor->tailable;
	 $cursor      =	$cursor->tailable(1);

       Tailable	cursor.

METHODS
       Mango::Cursor::Query inherits all methods from Mango::Cursor and
       implements the following	new ones.

   build_query
	 my $query = $cursor->build_query;
	 my $query = $cursor->build_query($explain);

       Generate	final query with cursor	attributes.

   clone
	 my $clone = $cursor->clone;

       Clone cursor.

   count
	 my $count = $cursor->count;

       Count number of documents this cursor can return. You can also append a
       callback	to perform operation non-blocking.

	 $cursor->count(sub {
	   my ($cursor,	$err, $count) =	@_;
	   ...
	 });
	 Mojo::IOLoop->start unless Mojo::IOLoop->is_running;

   distinct
	 my $values = $cursor->distinct('foo');

       Get all distinct	values for key.	You can	also append a callback to
       perform operation non-blocking.

	 $cursor->distinct(foo => sub {
	   my ($cursor,	$err, $values) = @_;
	   ...
	 });
	 Mojo::IOLoop->start unless Mojo::IOLoop->is_running;

   explain
	 my $doc = $cursor->explain;

       Provide information on the query	plan. You can also append a callback
       to perform operation non-blocking.

	 $cursor->explain(sub {
	   my ($cursor,	$err, $doc) = @_;
	   ...
	 });
	 Mojo::IOLoop->start unless Mojo::IOLoop->is_running;

SEE ALSO
       Mango, Mojolicious::Guides, <http://mojolicio.us>.

perl v5.32.0			  2018-03-17	       Mango::Cursor::Query(3)

NAME | SYNOPSIS | DESCRIPTION | ATTRIBUTES | METHODS | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Mango::Cursor::Query&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help