mongo::OID Class Reference
#include <oid.h>
List of all members.
Detailed Description
Object ID type. BSON objects typically have an _id field for the object id. This field should be the first member of the object when present. class OID is a special type that is a 12 byte id which is likely to be unique to the system. You may also use other types for _id's. When _id field is missing from a BSON object, on an insert the database may insert one automatically in certain circumstances.
Warning: You must call OID::newState() after a fork().
Typical contents of the BSON ObjectID is a 12-byte value consisting of a 4-byte timestamp (seconds since epoch), a 3-byte machine id, a 2-byte process id, and a 3-byte counter. Note that the timestamp and counter fields must be stored big endian unlike the rest of BSON. This is because they are compared byte-by-byte and we want to ensure a mostly increasing order.
Definition at line 39 of file oid.h.
Constructor & Destructor Documentation
mongo::OID::OID |
( |
|
) |
[inline] |
Definition at line 41 of file oid.h.
mongo::OID::OID |
( |
const string & |
s |
) |
[inline, explicit] |
init from a 24 char hex string
Definition at line 44 of file oid.h.
Member Function Documentation
Date_t mongo::OID::asDateT |
( |
|
) |
[inline] |
Definition at line 73 of file oid.h.
time_t mongo::OID::asTimeT |
( |
|
) |
|
void mongo::OID::clear |
( |
|
) |
[inline] |
initialize to 'null'
Definition at line 47 of file oid.h.
int mongo::OID::compare |
( |
const OID & |
other |
) |
const [inline] |
Definition at line 53 of file oid.h.
static void mongo::OID::foldInPid |
( |
MachineAndPid & |
x |
) |
[static, private] |
static OID mongo::OID::gen |
( |
|
) |
[inline, static] |
Definition at line 61 of file oid.h.
static MachineAndPid mongo::OID::genMachineAndPid |
( |
|
) |
[static, private] |
const unsigned char* mongo::OID::getData |
( |
|
) |
const [inline] |
Definition at line 49 of file oid.h.
static unsigned mongo::OID::getMachineId |
( |
|
) |
[static] |
void mongo::OID::init |
( |
Date_t |
date, |
|
|
bool |
max = false | |
|
) |
| | |
Set to the min/max OID that could be generated at given timestamp.
void mongo::OID::init |
( |
string |
s |
) |
|
init from a 24 char hex string
void mongo::OID::init |
( |
|
) |
|
sets the contents to a new oid / randomized value
bool mongo::OID::isSet |
( |
|
) |
const [inline] |
Definition at line 75 of file oid.h.
static void mongo::OID::justForked |
( |
|
) |
[static] |
call this after a fork to update the process id
bool mongo::OID::operator!= |
( |
const OID & |
r |
) |
const [inline] |
Definition at line 52 of file oid.h.
bool mongo::OID::operator< |
( |
const OID & |
other |
) |
const [inline] |
Definition at line 54 of file oid.h.
bool mongo::OID::operator<= |
( |
const OID & |
other |
) |
const [inline] |
Definition at line 55 of file oid.h.
bool mongo::OID::operator== |
( |
const OID & |
r |
) |
const [inline] |
Definition at line 51 of file oid.h.
static unsigned mongo::OID::ourPid |
( |
|
) |
[static, private] |
static void mongo::OID::regenMachineId |
( |
|
) |
[static] |
string mongo::OID::str |
( |
|
) |
const [inline] |
- Returns:
- the object ID output as 24 hex digits
Definition at line 58 of file oid.h.
string mongo::OID::toString |
( |
|
) |
const [inline] |
Definition at line 59 of file oid.h.
Member Data Documentation
Definition at line 95 of file oid.h.
Definition at line 94 of file oid.h.
Definition at line 93 of file oid.h.
Definition at line 98 of file oid.h.
Definition at line 99 of file oid.h.
Definition at line 89 of file oid.h.
Definition at line 89 of file oid.h.
The documentation for this class was generated from the following file: