Unserialize an ObjectId

- « MongoDB\BSON\ObjectId::__toString

- MongoDB\BSON\Regex »

- PHP Manual
- MongoDB\BSON\ObjectId
- Unserialize an ObjectId

# MongoDB\BSON\ObjectId::unserialize

(mongodb >=1.2.0)

MongoDB\BSON\ObjectId::unserialize — Unserialize an ObjectId

### Description

final public MongoDB\BSON\ObjectId::unserialize(string `$data`): void

### Parameters

`data`

  The serialized MongoDB\BSON\ObjectId.

### Return Values

No value is returned.

### Errors/Exceptions

- Throws MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors.
- Throws MongoDB\Driver\Exception\UnexpectedValueException if the properties cannot be unserialized (i.e. `serialized` was malformed).
- Throws MongoDB\Driver\Exception\InvalidArgumentException if the properties are invalid (e.g. missing fields or invalid values).

### See Also

- MongoDB\BSON\ObjectId::serialize() - Serialize an ObjectId
- unserialize() - Creates a PHP value from a stored representation
- Serializing Objects