Mango::Protocol - The MongoDB wire protocol
use Mango::Protocol; my $protocol = Mango::Protocol->new; my $bytes = $protocol->query(1, 'foo', {}, 0, 10, {}, {});
Mango::Protocol is a minimalistic implementation of the MongoDB wire protocol.
Mango::Protocol inherits all methods from Mojo::Base and implements the following new ones.
my $bytes = $protocol->build_get_more($id, $name, $return, $cursor);
Build message for GET_MORE operation.
GET_MORE
my $bytes = $protocol->build_kill_cursors($id, @ids);
Build message for KILL_CURSORS operation.
KILL_CURSORS
my $bytes = $protocol->build_query($id, $name, $flags, $skip, $return, $query, $fields);
Build message for QUERY operation.
QUERY
my $err = $protocol->command_error($doc);
Check document for command error.
my $id = $protocol->next_id(23);
Generate next id.
my $reply = $protocol->parse_reply(\$str);
Extract and parse reply message.
reply
my $err = $protocol->query_failure($reply);
Check reply for query failure.
my $err = $protocol->write_error($doc);
Check document for write error.
Mango, Mojolicious::Guides, http://mojolicio.us.
To install Mango, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mango
CPAN shell
perl -MCPAN -e shell install Mango
For more information on module installation, please visit the detailed CPAN module installation guide.