BSON (Binary JSON) is the data format used by popular MongoDB NoSQL database. It’s similar to JSON but designed for efficient storage and scanning. Unlike JSON, BSON is a binary format that is not human-readable by default. BSON’s binary structure encodes type and length information, which allows it to be parsed much more quickly than straight JSON. Since its initial formulation, BSON has been extended to add some optional non-JSON-native data types, like dates and binary data, which are essential for MongoDB.
Since BSON is a binary format, it cannot be edited readily in a text-based editor. However, XMLSpy includes a unique, graphical BSON editor called Grid View. Editing BSON in Grid View allows you to understand the structure of the binary document at a glance. You can scroll and expand/collapse items to view the document structure at different levels. The structure can be easily modified by adding, deleting, or moving objects in the grid. Entire blocks of text can be reorganized (for example, by sorting them or moving them).
Functionality like table mode for repeating nodes, automatic type detection, and in-cell editing commands make it easy to understand the structure of the binary document and edit it as needed.
In addition to graphical editing in Grid View, XMLSpy supports:
XMLSpy includes a powerful graphical JSON Schema editor with built-in support for defining BSON datatypes.
MongoDB provides the ability to validate database data against a JSON schema document. Because BSON datatypes supplement the standard JSON types, XMLSpy provides an editing layer for BSON that lets you add and modify BSON-specific schema features during JSON Schema development.
When you enable BSON support in JSON Schema View, BSON datatypes become available for JSON objects, properties, and array items. When a component's base type has been selected to be BSON, the BSON types become available for selection.
Support for BSON in the XMLSpy graphical JSON schema editor helps teams enable validation of real-world BSON data for MongoDB and other applications.
MongoDB is schema-less by default, but real-world apps often need to validate the structure and types of data being stored. That’s where JSON Schema comes in, and support for BSON in XMLSpy makes it easy to implement.
A real world example of where this support is important is a development team working on a healthcare app uses MongoDB to store patient records. They want to:
With XMLSpy, they can:
With its visual schema design paradigm, developers can get the job done quickly and with fewer errors. An optional final step is to use Altova MapForce to map, transform, and integrate the MongoDB data with other systems like SQL databases and XML reports.