MySQL Connector/Node.js 8.0.23 has been released


Dear MySQL users,

MySQL Connector/Node.js is a new Node.js driver for use with the X
DevAPI. This release, v8.0.23, is a maintenance release of the
MySQL Connector/Node.js 8.0 series.

The X DevAPI enables application developers to write code that combines
the strengths of the relational and document models using a modern,
NoSQL-like syntax that does not assume previous experience writing
traditional SQL.

MySQL Connector/Node.js can be downloaded through npm (see
  https://www.npmjs.com/package/@mysql/xdevapi for details) or from
  https://dev.mysql.com/downloads/connector/nodejs/.

To learn more about how to write applications using the X DevAPI, see
  http://dev.mysql.com/doc/x-devapi-userguide/en/.
For more information about how the X DevAPI is implemented in MySQL
Connector/Node.js, and its usage, see
  http://dev.mysql.com/doc/dev/connector-nodejs/.

Please note that the X DevAPI requires at least MySQL Server version
8.0 or higher with the X Plugin enabled. For general documentation
about how to get started using MySQL as a document store, see
  http://dev.mysql.com/doc/refman/8.0/en/document-store.html.

Changes in MySQL Connector/Node.js 8.0.23 (2021-01-18, General Availability)

* Functionality Added or Changed
* Bugs Fixed

Functionality Added or Changed

* Added custom debug functionality using the NODE_DEBUG
environment variable to log and inspect low-level details
for the application. Connector/Node.js now supports this
feature and uses it, in particular, for logging
information about the protocol messages (inbound and
outbound) that are exchanged with the MySQL server.
Messages sent by the client are available under the
protocol:outbound scope, whereas messages sent by the
server are available under the protocol:inbound scope.
For example, the following writes a textual protobuf
representation of every Mysqlx.Crud.Find and
Mysqlx.Resultset.Row message to stderr: shell> NODE_DEBUG=’protocol:outbound:Mysqlx.Crud.Find,protocol:inbound :Mysqlx.Resultset.Row’ node app.js

Node 10 and later supports wildcard pattern matching,
such as NODE_DEBUG=’protocol:inbound:*’ to filter out
inbound messages and NODE_DEBUG=’*’ to show all logs.
(Bug #31729043)

* Added a deprecation warning to the Connector/Node.js
installation process that future Connector/Node.js
versions do not guarantee compatibility with End-of-life
Node.js versions. If you are planning to upgrade, make
sure you are using Node.js 12.0.0 or higher.

Bugs Fixed

* Stored values in a DOUBLE column were truncated when
encoded and sent to the MySQL server. For example, a
value such as 1.000001 would become 1. They are now
encoded properly as double-precision floating numbers to
support the full range of 64-bit floating point precision
in MySQL columns with the DOUBLE data type (having in
mind possible rounding an approximations performed by the
database engine). (Bug #31734504)

* Improved consistency for method argument error handling
when an argument is not set or uses JavaScript’s
“undefined”. (Bug #31709879)

* Refactored code to disable all debugging utilities when
debug mode is off. (Bug #31584269)

On Behalf of MySQL Release Engineering Team,
Surabhi Bhat

MySQL Connector/Node.js 8.0.21 has been released

Dear MySQL users,

MySQL Connector/Node.js is a new Node.js driver for use with the X
DevAPI. This release, v8.0.21, is a maintenance release of the
MySQL Connector/Node.js 8.0 series.

The X DevAPI enables application developers to write code that combines
the strengths of the relational and document models using a modern,
NoSQL-like syntax that does not assume previous experience writing
traditional SQL.

MySQL Connector/Node.js can be downloaded through npm (see
https://www.npmjs.com/package/@mysql/xdevapi for details) or from
https://dev.mysql.com/downloads/connector/nodejs/.

To learn more about how to write applications using the X DevAPI, see
http://dev.mysql.com/doc/x-devapi-userguide/en/.
For more information about how the X DevAPI is implemented in MySQL
Connector/Node.js, and its usage, see
http://dev.mysql.com/doc/dev/connector-nodejs/.

Please note that the X DevAPI requires at least MySQL Server version
8.0 or higher with the X Plugin enabled. For general documentation
about how to get started using MySQL as a document store, see
http://dev.mysql.com/doc/refman/8.0/en/document-store.html.

Changes in MySQL Connector/Node.js 8.0.21 (2020-07-13, General Availability)

Functionality Added or Changed

* Creating a collection now supports options to enable validation of a JSON schema that documents must adhere to before they are permitted to be inserted or updated. The new ModifyCollection method allows updating the schema of an existing collection. In the createCollection method, the option to re-use an existing collection was renamed from ReuseExistingObject to reuseExisting. Schema validation is performed by the server, which returns an error message if a document in a collection does not match the schema definition or if the server does not support validation. If a given collection already exists in the database, the createCollection fails unless the reuseExisting property is enabled in an additional options object such as the following example:

const mysqlx = require(‘@mysql/xdevapi’);

mysqlx.getSession(‘mysqlx://localhost:33060’)
.then(sesion => {
return session.getSchema(‘mySchema’).createCollection(‘myColle
ction’, { reuseExisting: true })
});

You can also use the options object to, for example, create a server-side document validation schema. For that, you can include a schema property matching a valid JSON schema definition within an outer validation object. You should also include the level property where STRICT enables it and OFF disables it. For example:

const mysqlx = require(‘@mysql/xdevapi’);
const validation = { schema: { type: ‘object’, properties: { name: { t
ype: ‘string’ } } }, level: mysqlx.Schema.ValidationLevel.STRICT };

mysqlx.getSession(‘mysqlx://localhost:33060’)
.then(sesion => {
return session.getSchema(‘mySchema’).createCollection(‘myColle
ction’, { validation })
});

The same level property logic applies to modifyCollection. Here’s an example to enable a JSON schema on an existing collection (or to update it if it already exists) using the STRICT validation level:

const mysqlx = require(‘@mysql/xdevapi’);
const validation = { schema: { type: ‘object’, properties: { name: { t
ype: ‘string’ } } }, level: mysqlx.Schema.ValidationLevel.STRICT };

mysqlx.getSession(‘mysqlx://localhost:33060’)
.then(sesion => {
return session.getSchema(‘mySchema’).modifyCollection(‘myColle
ction’, { validation })
});

Bugs Fixed

* Row values for columns of type BIGINT were not correctly decoded by Connector/Node.js. Upgrading the google-protobuf library (to 3.11.4) fixed this problem. (Bug #27570685)

On Behalf of MySQL/ORACLE RE Team
Gipson Pulla