MongoDB\BSON\Document::fromBSON
PHP function
Edit on GitHub ✎
(mongodb >=1.16.0)
Construct a new document instance from a BSON string
Description
MongoDB\BSON\Document::fromBSON(string $bson): MongoDB\BSON\Document
Parameters
bson(string)A string containing a document in BSON format.
Return Values
Returns a new MongoDB\BSON\Document instance.
Errors/Exceptions
- Throws
MongoDB\Driver\Exception\UnexpectedValueExceptionifbsonis an invalid BSON string or contains more than a single document.
See Also
MongoDB\BSON\Document::fromPHPMongoDB\BSON\Document::fromJSON- BSON Types