MongoDB uses BSON, a binary serialization format, to store documents and to exchange data. MongoDB使用二进制序列化格式BSON来存储文档和交换数据。BSON is a rich format and has data types that aren't included in the JSON standard. BSON是一种丰富的格式,其数据类型不包含在JSON标准中。Extended JSON (EJSON) adds support for the additional types. EJSON is a JSON compatible way to represent BSON values.扩展JSON(EJSON)增加了对其他类型的支持。EJSON是一种与JSON兼容的方式来表示BSON值。
mongosh exposes the EJSON interface from the Node.js BSON parser to help you transform your data. Use the EJSON interface when you need to transform BSON data.mongosh公开了Node.js-BSON解析器的EJSON接口,以帮助您转换数据。当您需要转换BSON数据时,请使用EJSON接口。
| EJSON | Use |
|---|---|
EJSON.deserialize() | |
EJSON.stringify() | mongosh output.mongosh输出很有用。 |
EJSON.serialize() | |
EJSON.parse() |
For additional EJSON capabilities, see the npm EJSON documentation.有关其他EJSON功能,请参阅npm EJSON文档。