.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mango::Cursor::Query 3pm" .TH Mango::Cursor::Query 3pm "2020-06-05" "perl v5.30.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mango::Cursor::Query \- MongoDB query cursor .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Mango::Cursor::Query; \& \& my $cursor = Mango::Cursor::Query\->new(collection => $collection); \& my $docs = $cursor\->all; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Mango::Cursor::Query is a container for MongoDB query cursors used by Mango::Collection. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" Mango::Cursor::Query inherits all attributes from Mango::Cursor and implements the following new ones. .SS "await_data" .IX Subsection "await_data" .Vb 2 \& my $await = $cursor\->await_data; \& $cursor = $cursor\->await_data(1); .Ve .PP Await data. .SS "comment" .IX Subsection "comment" .Vb 2 \& my $comment = $cursor\->comment; \& $cursor = $cursor\->comment(\*(AqFun query!\*(Aq); .Ve .PP A comment to identify query. .SS "fields" .IX Subsection "fields" .Vb 2 \& my $fields = $cursor\->fields; \& $cursor = $cursor\->fields({foo => 1}); .Ve .PP Select fields from documents. .SS "hint" .IX Subsection "hint" .Vb 2 \& my $hint = $cursor\->hint; \& $cursor = $cursor\->hint({foo => 1}); .Ve .PP Force a specific index to be used. .SS "max_scan" .IX Subsection "max_scan" .Vb 2 \& my $max = $cursor\->max_scan; \& $cursor = $cursor\->max_scan(500); .Ve .PP Limit the number of documents to scan. .SS "max_time_ms" .IX Subsection "max_time_ms" .Vb 2 \& my $max = $cursor\->max_time_ms; \& $cursor = $cursor\->max_time_ms(500); .Ve .PP Timeout for query in milliseconds. .SS "query" .IX Subsection "query" .Vb 2 \& my $query = $cursor\->query; \& $cursor = $cursor\->query({foo => \*(Aqbar\*(Aq}); .Ve .PP Original query. .SS "read_preference" .IX Subsection "read_preference" .Vb 2 \& my $pref = $cursor\->read_preference; \& $cursor = $cursor\->read_preference({mode => \*(AqSECONDARY\*(Aq}); .Ve .PP Read preference. .SS "skip" .IX Subsection "skip" .Vb 2 \& my $skip = $cursor\->skip; \& $cursor = $cursor\->skip(5); .Ve .PP Number of documents to skip, defaults to \f(CW0\fR. .SS "snapshot" .IX Subsection "snapshot" .Vb 2 \& my $snapshot = $cursor\->snapshot; \& $cursor = $cursor\->snapshot(1); .Ve .PP Use snapshot mode. .SS "sort" .IX Subsection "sort" .Vb 3 \& my $sort = $cursor\->sort; \& $cursor = $cursor\->sort({foo => 1}); \& $cursor = $cursor\->sort(bson_doc(foo => 1, bar => \-1)); .Ve .PP Sort documents, the order of keys matters. .SS "tailable" .IX Subsection "tailable" .Vb 2 \& my $tailable = $cursor\->tailable; \& $cursor = $cursor\->tailable(1); .Ve .PP Tailable cursor. .SH "METHODS" .IX Header "METHODS" Mango::Cursor::Query inherits all methods from Mango::Cursor and implements the following new ones. .SS "build_query" .IX Subsection "build_query" .Vb 2 \& my $query = $cursor\->build_query; \& my $query = $cursor\->build_query($explain); .Ve .PP Generate final query with cursor attributes. .SS "clone" .IX Subsection "clone" .Vb 1 \& my $clone = $cursor\->clone; .Ve .PP Clone cursor. .SS "count" .IX Subsection "count" .Vb 1 \& my $count = $cursor\->count; .Ve .PP Count number of documents this cursor can return. You can also append a callback to perform operation non-blocking. .PP .Vb 5 \& $cursor\->count(sub { \& my ($cursor, $err, $count) = @_; \& ... \& }); \& Mojo::IOLoop\->start unless Mojo::IOLoop\->is_running; .Ve .SS "distinct" .IX Subsection "distinct" .Vb 1 \& my $values = $cursor\->distinct(\*(Aqfoo\*(Aq); .Ve .PP Get all distinct values for key. You can also append a callback to perform operation non-blocking. .PP .Vb 5 \& $cursor\->distinct(foo => sub { \& my ($cursor, $err, $values) = @_; \& ... \& }); \& Mojo::IOLoop\->start unless Mojo::IOLoop\->is_running; .Ve .SS "explain" .IX Subsection "explain" .Vb 1 \& my $doc = $cursor\->explain; .Ve .PP Provide information on the query plan. You can also append a callback to perform operation non-blocking. .PP .Vb 5 \& $cursor\->explain(sub { \& my ($cursor, $err, $doc) = @_; \& ... \& }); \& Mojo::IOLoop\->start unless Mojo::IOLoop\->is_running; .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Mango, Mojolicious::Guides, .