+ fun message: CString `{ return self->message; `}
+end
+
+# Wrapper for `bson_oid_t`.
+#
+# The `bson_oid_t` structure contains the 12-byte ObjectId notation defined by the
+# [BSON ObjectID specificiation](http://docs.mongodb.org/manual/reference/object-id/).
+#
+# ObjectId is a 12-byte BSON type, constructed using:
+# * a 4-byte value representing the seconds since the Unix epoch (in Big Endian)
+# * a 3-byte machine identifier
+# * a 2-byte process id (Big Endian), and
+# * a 3-byte counter (Big Endian), starting with a random value.
+extern class BSONObjectId `{ bson_oid_t * `}
+
+ # Generates a new `bson_oid_t`.
+ new `{
+ bson_oid_t *self = malloc(sizeof(bson_oid_t));
+ bson_oid_init(self, NULL);
+ return self;
+ `}
+
+ # Object id.
+ fun id: String import CString.to_s_with_copy `{
+ char str[25];
+ bson_oid_to_string(self, str);
+ return CString_to_s_with_copy(str);
+ `}
+
+ # Destroy `self`.
+ fun destroy `{ free(self); `}