- Reference >
- MongoDB Extended JSON
MongoDB Extended JSON¶
MongoDB import and export utilities (i.e. mongoimport
and
mongoexport
) and MongoDB REST Interfaces render an approximation of MongoDB BSON
documents in JSON format.
The REST interface supports three different modes for document output:
- Strict mode that produces output that conforms to the JSON RFC specifications.
- JavaScript mode that produces output that most JavaScript
interpreters can process (via the
--jsonp
option) mongo
Shell mode produces output that themongo
shell can process. This is “extended” JavaScript format.
MongoDB can process of these representations in REST input.
Special representations of BSON data in JSON format make it possible to render information that have no obvious corresponding JSON. In some cases MongoDB supports multiple equivalent representations of the same type information. Consider the following table:
BSON Data Type | Strict Mode | JavaScript Mode (via JSONP) | mongo Shell Mode | Notes |
---|---|---|---|---|
|
|
|||
|
<date> is the JSON representation of a 64-bit signed
integer for milliseconds since epoch UTC (unsigned before
version 1.9.1). |
|||
|
|
|||
|
|
|||
|
<id> is a 24-character hexadecimal string. |
|||
|
|
|||
|
The representation for the JavaScript/BSON undefined type. | |||
|
The representation of the MinKey BSON data type that compares lower than all other types. See What is the compare order for BSON types? for more information on comparison order for BSON types. | |||
|
The representation of the MaxKey BSON data type that compares higher than all other types. See What is the compare order for BSON types? for more information on comparison order for BSON types. |