Monday, January 21, 2019

MySQL Shell 8.0.14 now with BSON

I have been asked the MySQL Shell handles BSON and now with today's release of version 8.0.,14, it does.  Version 8.0.13 added a very hand and blazing fast JSON bulk loader you get the ability to map and how the data is converted. The details are at the Conversions for representations of BSON data types page

From the 8.0.14 release notes:

 * The MySQL Shell JSON import utility can now process BSON
       (binary JSON) data types that are represented in JSON
       documents. The data types used in BSON documents are not
       all natively supported by JSON, but can be represented
       using extensions to the JSON format. The import utility
       can process documents that use JSON extensions to
       represent BSON data types, convert them to an identical
       or compatible MySQL representation, and import the data
       value using that representation. The resulting converted
       data values can be used in expressions and indexes, and
       manipulated by SQL statements and X DevAPI functions.
       To convert JSON extensions for BSON types into MySQL
       types in this way, you must specify the convertBsonTypes
       option when you run the import utility. Additional
       options are available to control the mapping and
       conversion for specific BSON data types. If you import
       documents with JSON extensions for BSON types and do not
       use this option, the documents are imported in the same
       way as they are represented in the input file.

One of the handier items is  the --decimalAsDouble switch to
convert the value of the BSON decimal type to a MySQL DOUBLE type instead of  a string.

One of the things to note is that the default option is that the documents are imported in the same way they were in the input file.  There ware ways to convert, decimals, dates, time stamps in the like but for those of you needed a quick upload of data from a MongoDB, this will be very useful.

1 comment: