NAME

BSON::OID - BSON type wrapper for Object IDs

VERSION

version v0.999.5

SYNOPSIS

use BSON::Types ':all';

my $oid  = bson_oid();

my $bytes = $oid->oid;
my $hex   = $oid->hex;

DESCRIPTION

This module provides a wrapper around a BSON Object ID.

ATTRIBUTES

oid

A 12-byte (packed) Object ID (OID) string. If not provided, a new OID will be generated.

METHODS

hex

Returns the oid attributes as 24-byte hexadecimal value

get_time

Returns a number corresponding to the portion of the oid value that represents seconds since the epoch.

TO_JSON

Returns a string for this OID, with the OID given as 24 hex digits.

If the BSON_EXTJSON option is true, it will instead be compatible with MongoDB's extended JSON format, which represents it as a document as follows:

{"$oid" : "012345678901234567890123"}

OVERLOAD

The string operator is overloaded so any string operations will actually use the 24-character hex value of the OID. Fallback overloading is enabled.

THREADS

This module is thread safe.

AUTHORS

  • David Golden <david@mongodb.com>

  • Stefan G. <minimalist@lavabit.com>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016 by Stefan G. and MongoDB, Inc.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004