MySQL Connector/Node.js 1.0.5 m4 development has been released

MySQL Connector/Node.js is a new Node.js driver for use with the X DevAPI. This release, v1.0.5 M4, is the fourth development release of the MySQL Connector/Node.js 1.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.

To learn more about how to write applications using the X DevAPI, see For more information about how the X DevAPI is implemented in MySQL Connector/Node.js, and its usage, see


Please note that the X DevAPI requires at least MySQL Server version 5.7.12 or higher with the X Plugin enabled. For general documentation about how to get started using MySQL as a document store, see

Functionality Added or Changed

  • Added APIs for Transaction handling.
  • Added a Table creation API.

Enjoy and thanks for the support!

On behalf of the MySQL/Oracle Release Engineering Team
Piotr Obrzut

MySQL Connector/Node.JS 1.0.4 now on

MySQL Connector/Node.JS 1.0.4 was recently released as a development milestone release. This is the first version available via is the central registry for Node.JS packages. This and potential future official MySQL packages can be found using the @mysql organisation. For this to work we had to change the package name to contain that prefix and have chosen the name @mysql/xdevapi as this package provides the implementation of our X DevAPI for Node.JS and we have a free namespace for potential future libraries as part of our Connector/Node.JS product.


Given an existing Node.JS project we can easily install the library:

$ npm install --save @mysql/xdevapi
myapp@1.0.0 /home/johannes/experiments/myapp
└── @mysql/xdevapi@1.0.4

As presented with previous releases the implementation is built around Promises. After the installation it’s easy to ask for a session:

const xdevapi = require('@mysql/xdevapi');
const promise = xdevapi.getSession({
    host: 'localhost',
    port: 33060,
    dbUser: 'username',
    dbPassword: 'veryverysecret'

If the MySQL Server is running and the X Plugin was loaded this Promise object will resolve to a session, else it will be rejected.

As a new feature in 1.0.4 the connection parameters can also be provided in form of an URL. As the URL is defined in the X DevAPI it can be shared among applications using different languages and MySQL Connectors:

const xdevapi = require('@mysql/xdevapi');
const promise = xdevapi.getSession('mysqlx://username:veryverysecret@hostname');

Another new feature in MySQL Connector/Node.JS is support for view DDL operations. To create a view a CRUD select object can be used:

const myschema = session.getSchema('myschema');
const table = myschema.getTable('a_table');
const selection =['id', 'CONCAT(field1, field2)']).where('1 = 2');
const viewDefinition = myschema.createView('a_view');
const promise = viewDefinition.definedAs(selection).security(viewDefinition.INVOKER).execute();

In case the view isn’t needed anymore it can of course be dropped again:

const promise = session.getSchema('myschema').dropView('a_view');

For information purpose another addition are functions to gather row or document counts from tables or collections:

const promise1 = myschema.getTable('a_table').count();
const promise2 = myschema.getCollection('a_collection').count();

For the future there’s more to come. We’re working on different improvements to the API and performance. More on this in a later post.