Mango::BSON::ObjectID(3pm)

Mango::BSON::ObjectID3pm

Object id type

Usage

  use Mango::BSON::ObjectID;
  my $oid = Mango::BSON::ObjectID->new('1a2b3c4e5f60718293a4b5c6');
  say $oid->to_epoch;

Overview

Mango::BSON::ObjectID is a container for the BSON object id type used by Mango::BSON.

Methods

Mango::BSON::ObjectID inherits all methods from Mojo::Base and implements the following new ones.

from_epoch

  my $oid = $oid->from_epoch(1359840145);

Generate new object id with specific epoch time.

new

  my $oid = Mango::BSON::ObjectID->new;
  my $oid = Mango::BSON::ObjectID->new('1a2b3c4e5f60718293a4b5c6');

Construct a new Mango::BSON::ObjectID object.

to_bytes

  my $bytes = $oid->to_bytes;

Object id in binary form.

to_epoch

  my $epoch = $oid->to_epoch;

Extract epoch seconds from object id.

to_string

  my $str = $oid->to_string;

Stringify object id.

Operators

Mango::BSON::ObjectID overloads the following operators.

bool

  my $bool = !!$oid;

Always true.

stringify

  my $str = "$oid";

Alias for "to_string".

Releases

6 releases since Debian 8 (Jessie); the text changed 3 times.

  1. 8
  2. 9
  3. 10
  4. 11–13

From libmango-perl 1.30-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.