Mango::Protocol(3pm)

πŸ“¦
version 1.30 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’… Mango::Protocol πŸ’…

okay bestie, welcome to Mango::Protocol β€” this is the MongoDB wire protocol, the 3pm Perl doc version, and yes she's minimalistic and yes she's iconic. periodt ✨


🌸 SYNOPSIS 🌸

like, here's the vibe, copy it exactly okay:

use Mango::Protocol;

my $protocol = Mango::Protocol->new;
my $bytes    = $protocol->query(1, 'foo', {}, 0, 10, {}, {});

πŸ¦‹ DESCRIPTION πŸ¦‹

Mango::Protocol is a minimalistic implementation of the MongoDB wire protocol. that's it, that's the whole girl. she does one thing and she does it well, no cap πŸ’–


πŸ‘‘ METHODS πŸ‘‘

so Mango::Protocol inherits all the methods from Mojo::Base (love that for her) and then she implements these brand new ones below. slay.

πŸŽ€ build_get_more

my $bytes = $protocol->build_get_more($id, $name, $return, $cursor);

Builds the message for the GET_MORE operation. πŸ’«

πŸŽ€ build_kill_cursors

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

Builds the message for the KILL_CURSORS operation. bye bye cursors 🫢

πŸŽ€ build_query

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

Builds the message for the QUERY operation. the main character of message-building fr fr πŸ”₯

πŸŽ€ command_error

my $err = $protocol->command_error($doc);

Checks a document for a command error. πŸ”

πŸŽ€ next_id

my $id = $protocol->next_id(23);

Generates the next id. ✨

πŸŽ€ parse_reply

my $reply = $protocol->parse_reply(\$str);

Extracts and parses the reply message. πŸ’Œ

πŸŽ€ query_failure

my $err = $protocol->query_failure($reply);

Checks a reply for a query failure. 😭

πŸŽ€ write_error

my $err = $protocol->write_error($doc);

Checks a document for a write error. πŸ’€


🌈 SEE ALSO 🌈


and that's the whole page bestie πŸŽ€ this lil cutie is Mango::Protocol, documented under perl v5.30.3, dated 2020-06-05, and she ate. go build some wire protocol messages, ily πŸ’–βœ¨πŸ¦‹