NAME

Mango::BSON::ObjectID - Object ID type

SYNOPSIS

use Mango::BSON::ObjectID;

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

DESCRIPTION

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.

new

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

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

from_epoch

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

Generate new object id with specific epoch time.

to_epoch

my $epoch = $oid->to_epoch;

Extract epoch seconds from object id.

to_string

my $str = $oid->to_string;
my $str = "$oid";

Stringify object id.

SEE ALSO

Mango, Mojolicious::Guides, http://mojolicio.us.