One particular way in which BSON differs from JSON is in its support for some more advanced types of data. BSON is designed as a binary representation of JSON data, with specific extensions for broader applications, and optimized for data storage and retrieval.
![python json query language python json query language](https://www.fatalerrors.org/images/blog/4cba9b9eb062a41cef42a74188552425.jpg)
![python json query language python json query language](https://media.geeksforgeeks.org/wp-content/uploads/20200515192629/Screenshot-from-2020-05-15-18-03-441.png)
JSON and BSON are indeed close cousins by design. String, Boolean, Number (Integer, Float, Long, Decimal128.), Array, Date, Raw Binary
PYTHON JSON QUERY LANGUAGE HOW TO
Third, BSON supports a variety of numeric types that are not native to JSON, and each language will represent these differently.Ĭheck your driver documentation to make sure you understand how to best access MongoDB BSON-backed data in your language to avoid confusion, and get the most out of your MongoDB experience. 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. When using a MongoDB driver in your language of choice, it’s still important to know that you’re accessing BSON data through the abstractions available in that language.įirstly, BSON objects may contain Date or Binary objects that are not natively representable in pure JSON. Unlike systems that simply store JSON as string-encoded values, or binary-encoded blobs, MongoDB uses BSON to offer the industry’s most powerful indexing and querying features on top of the web’s most usable 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.