MongoDB\BSON\Document::fromJSON
(mongodb >=1.16.0)
MongoDB\BSON\Document::fromJSON — Construct a new document instance from a JSON string
Description
Converts an » extended JSON string to its BSON representation.
Return Values
Returns a new MongoDB\BSON\Document instance.
Errors/Exceptions
- Throws MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors.
- Throws MongoDB\Driver\Exception\UnexpectedValueException if the JSON value cannot be converted to a BSON document (e.g. due to a syntax error).
See Also
- MongoDB\BSON\Document::fromPHP() - Construct a new document instance from PHP data
- MongoDB\BSON\Document::fromBSON() - Construct a new document instance from a BSON string
- » MongoDB Extended JSON
- » BSON Types
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
