*to_string = \&value;
sub get_time {
return hex(substr($_[0]->{value}, 0, 8));
}
sub TO_JSON { {'$oid' => $_[0]->{value}} }
use overload
'""' => \&to_string,
'fallback' => 1;
1;
he timestamp.
=head2 TO_JSON
my $json = JSON->new;
$json->allow_blessed;
$json->convert_blessed;
$json->encode(MongoDB::Async::OID->new);
Returns a JSON string for this OID. Thi
s is compatible with the strict JSON
representation used by MongoDB, that is, an OID with the value
"012345678901234567890123" will be represented as
C<{"$oid" : "012345678901234567890123"}>.
=head