array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'class.mongodb-bson-objectid.php', 1 => 'MongoDB\\BSON\\ObjectId', ), 'up' => array ( 0 => 'book.bson.php', 1 => 'MongoDB\\BSON', ), 'prev' => array ( 0 => 'mongodb-bson-minkey.unserialize.php', 1 => 'MongoDB\\BSON\\MinKey::unserialize', ), 'next' => array ( 0 => 'mongodb-bson-objectid.construct.php', 1 => 'MongoDB\\BSON\\ObjectId::__construct', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mongodb/bson/objectid.xml', ), 'extra_header_links' => array ( 'rel' => 'alternate', 'href' => '/manual/en/feeds/class.mongodb-bson-objectid.atom', 'type' => 'application/atom+xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(mongodb >=1.0.0)
BSON type for an » ObjectId. The value consists of 12 bytes, where the first four bytes are a timestamp that reflect the ObjectId's creation. Specifically, the value consists of:
In MongoDB, each document stored in a collection requires a unique
_id
field that acts as a primary key. If an inserted
document omits the _id
field, the driver automatically
generates an ObjectId for the _id
field.
Using ObjectIds for the _id
field provides the following
additional benefits:
_id
field that stores ObjectId values is roughly equivalent to sorting by creation time.
Versão | Descrição |
---|---|
PECL mongodb 1.12.0 | Implements Stringable for PHP 8.0+. |
PECL mongodb 1.3.0 |
Renamed from Implements MongoDB\BSON\ObjectIdInterface. |
PECL mongodb 1.2.0 | Implements Serializable and JsonSerializable. |