DOKK / manpages / debian 10 / libmango-perl / Mango::Protocol.3pm.en
Mango::Protocol(3pm) User Contributed Perl Documentation Mango::Protocol(3pm)

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.

  my $bytes = $protocol->build_kill_cursors($id, @ids);

Build message for "KILL_CURSORS" operation.

  my $bytes = $protocol->build_query($id, $name, $flags, $skip, $return,
    $query, $fields);

Build message for "QUERY" operation.

  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.

  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>.

2018-04-14 perl v5.26.1