JSON and BSON are indeed close cousins by design. String, Boolean, Number (Integer, Float, Long, Decimal128.), Array, null, Date, BinData String, Boolean, Number, Array, Object, null Third, BSON supports a variety of numeric types that are not native to JSON, and many languages represent these differently.Ĭheck your driver documentation to make sure you understand how to best access MongoDB BSON-backed data in your language. JSON objects have ordered keys, for instance, while Python dictionaries (the closest native data structure that’s analogous to JavaScript objects) are unordered, while differences in numeric and string data types can also come into play. Second, each programming language has its own object semantics. Unlike systems that store JSON as string-encoded values, or binary-encoded blobs, MongoDB uses BSON to offer powerful indexing and querying features on top of the web’s most popular data format.įor example, MongoDB allows developers to query and manipulate objects by specific keys inside the JSON/BSON document, even in nested documents many layers deep into a record, and create high-performance indexes on those same keys and values.įirstly, BSON documents may contain Date or Binary objects that are not natively representable in pure JSON. The driver will take care of converting the data to BSON and back when querying the database. When using the MongoDB driver for your favorite programming language, you work with the native data structures for that language. Anything you can represent in JSON can be natively stored in MongoDB, and retrieved just as easily in JSON. MongoDB stores data in BSON format both internally, and over the network, but that doesn’t mean you can’t think of MongoDB as a JSON database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |