MySQL Connector/Node.js 8.0.11 GA has been released

MySQL Connector/Node.js is a new Node.js driver for use with the X DevAPI. This release, v8.0.11, is the first general availability 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 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 http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

Changes in MySQL Connector/Node.js 8.0.11 (2018-04-19, General
Availability)

Functionality Added or Changed

  • The protobuf.js library was replaced with the official google-protobuf npm package.
  • Added NOWAIT and SKIP_LOCKED support to the lockShared() and lockExclusive() methods. Example usage: lockShared(mysqlx.LockContention.SKIP_LOCKED).
  • Added the X DevAPI SHA256_MEMORY authentication mechanism.
  • Auto-generated document _id values generated by the MySQL server, introduced in MySQL Server 8.0.11, are now supported.

Bugs Fixed

  • Running a select query against a table containing BIGINT values and using those values as filtering criteria could fail to function. This was because those values were converted to JavaScript numbers when encoding the protobuf message, and lost precision since the maximum safe integer in JavaScript is 2^53 – 1. (Bug #27570761)
  • Row values from columns using the FLOAT type were not rounded according to the maximum number of displayable decimal digits defined by the schema. For example, a column with type FLOAT(3,2) containing a value of 1.23456789 would display as 1.2300000190734863 instead of the expected 1.23. (Bug #27570541)
  • Row values from columns using the BIT (http://dev.mysql.com/doc/refman/5.7/en/bit-type.html) data type were decoded as their sign integer counterpart instead of unsigned values. For example, b’111′ was decoded as -4 instead of 7. (Bug #27570462)
  • Row values for columns of any type of UNSIGNED integer (TINYINT, SMALLINT, MEDIUMINT, INT or BIGINT) were being interpreted by the connector as their SIGNED integer value counterpart. (Bug #27570342)
  • The sort() method was added to the following operations: CollectionFind, CollectionRemove, and CollectionModify. (Bug #27429922)
  • While adding a document, the expression parser was rejecting valid escaped literally strings that constituted properties of the document, and it threw unexpected errors. (Bug #27429852)
  • Messages split into multiple fragments (either because they exceeded the MTU or the maximum size of V8 buffers) were improperly reconstructed and could not be decoded. This behavior would throw an error similar to “Uncaught SyntaxError: Unexpected token”. (Bug #27429429)
  • Several methods returned plain JavaScript objects that now return iterable arrays. Schema.getCollections() now returns an array of Collection instances, Schema.getTables() now returns an array of Table instances, and Session.getSchemas() now returns an array of Schema instances. (Bug #27294362, Bug #27221114)
  • The expression parser was executed every time a document was added but now requires mysqlx.expr() to be explicitly called. For example, before collection.add({ name: ‘foo’ }) would parse the “name” property. Now, to parse it, use collection.add({ name: mysqlx.expr(‘”foo”‘) }). (Bug #27177864)

Enjoy and thanks for the support!

MySQL Connector/Node.js 8.0.9 RC has been released

MySQL Connector/Node.js is a new Node.js driver for use with the X DevAPI. This release, v8.0.9, is the third development 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/.

Note

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 http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

Functionality Added or Changed

  • Improved the UUID generation algorithm to implement the design improvements suggested in RFC 4122. Before the chance of duplicated values during a small time frame was too high. (Bug #26120588)
  • X DevAPI: In the process of refining the definition of the X DevAPI to cover the most relevant usage scenarios, the following API components have been removed from the X DevAPI implementation for Connector/Node.js:
    • API components that support session configurations, such as the SessionConfig and SessionConfigManager classes.
    • The mysqlx.config namespace and all methods of the namespace, save(), get(), list(), delete(), and more.
    • The createTable(), foreignKey(), dropTable(), createView(), dropView(), and alterView() methods from the Schema class.
  • The following methods were added:
    • Session.setSavePoint: accepts a name or generates one of the form connector-nodejs-{uuid}, and returns a Promise.
    • Session.releaseSavePoint: releases a specific savepoint.
    • Session.rollbackTo: rollbacks to a specified savepoint.
  • The createIndex() method was added to the Collection API.

Bugs Fixed

  • The expression parser used by the CRUD API was replaced with a new implementation written in pure JavaScript. This fixes several grammar related bugs. (Bug #26729768, Bug #26636956, Bug #25036336, Bug #23148246)
  • The CollectionFind.fields() method was updated to support flexible parameters to follow standard X DevAPI conventions. (Bug #22084545)

Enjoy and thanks for the support!

MySQL Connector/Node.js 8.0.8-dmr has been released

MySQL Connector/Node.js is a new Node.js driver for use with the X
DevAPI. This release, v8.0.8, is the second development 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/.

Note

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
http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

Functionality Added or Changed

Bugs Fixed

  • Added support for the parentheses-based IN syntax, such as IN (x, y, z, …), as defined in the X DevAPI. (Bug #26666817)

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

MySQL Connector/NodeJS 8.0.7-dmr has been released

MySQL Connector/Node.js is a new Node.js driver for use with the X
DevAPI. This release, v8.0.7 , is the first development 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/.

Note

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
http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

MySQL Connectors and other MySQL client tools and applications now
synchronize the first digit of their version number with the (highest)
MySQL server version they support. This change makes it easy and intuitive
to decide which client version to use for which server version.

Connector/Node.js 8.0.7 is the first release to use the new
numbering. It is the successor to Connector/Node.js 1.0.6.

Functionality Added or Changed

  • It is no longer permitted to pass an empty search condition, such as the NULL value or an empty string, to the Collection.modify() and Collection.remove() methods.
  • A number of changes have been implemented for the “drop” methods:
    • The “drop” methods are now made available at the same level as the corresponding “create” methods. For example, the dropCollection() and dropTable() methods have been removed from the XSession class (which has now been consolidated into the Session class) and moved under the Schema class; under the same principle, the drop() method has been removed from the Collection and Table classes.
    • The “drop” methods now succeed even if the objects to be dropped do not exist.
    • dropView() is now asynchronous and behaves exactly like dropTable() and dropCollection() by implicitly executing the operation and returning a promise that will hold the result of the drop operation.
  • A configuration handler interface, mysqlx.config, has been created for managing persisted session configurations. See MySQL Connector/Node.js with X DevAPI
    (http://dev.mysql.com/doc/dev/connector-nodejs/) for details.
  • There are a few changes with regard to secure connections to MySQL servers:
    • Connections are now secure by default.
    • The connection option ssl-enable has been replaced by the ssl-mode option, which has DISABLED, REQUIRED (default), and VERIFY_CA as its permitted values
    • Using the ssl-crl option requires the use of the ssl-ca option and that ssl-mode=VERIFY_CA; this is due to an internal requirement of the Node.js core platform.
  • Consolidated the BaseSession, NodeSession, and XSession into a single Session class. The following related changes were also made:
    • The mysqlx.getNodeSession() method is renamed to getSession and returns a Session object.
    • The DatabaseObject.getSession() now returns a Session object.
  • A new client-side failover feature has been implemented: when creating a new connection, multiple hosts now can be specified in the connection string, and Connector/Node.js tries each host until a successful connection is established or until all hosts have been tried. See Tutorial: Getting Started
    (http://dev.mysql.com/doc/dev/connector-nodejs/tutorial-Getting_Started.html)
    for details
  • Connector/Node.js now supports connecting to a local server using Unix sockets. See Tutorial: Getting Started
    (http://dev.mysql.com/doc/dev/connector-nodejs/tutorial-Getting_Started.html)
    for details.
  • The format of the document ID value generated when adding a document to a collection has changed. It is still a string of 32 hexadecimal digits based on a UUID, but the order of digits has been changed to match the requirement of a stable ID prefix.

Bugs Fixed

    • It was not possible to create a new session for a user with a SHA256 password via the PLAIN authentication mechanism. (Bug #26117627)
    • The handling of large JSON arrays was problematic, and would cause an exception to be thrown. (Bug #26084604)
    • Attempting to use bind when removing a document from a collection would not succeed, and an exception would be thrown. (Bug #26029551)
    • The Table.update() implementation did not require a SearchConditionStr parameter, and not using this parameter could result in updating all the rows of a given table. A client-side exception is now thrown if the SearchConditionStr parameter is undefined or empty. (Bug #25993174)
    • The Table.delete() implementation did not require a SearchConditionStr parameter, and not using this parameter could result in deleting all the rows of a given table. A client-side exception is now thrown if the SearchConditionStr parameter is undefined or empty. (Bug #25992969)

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

MySQL Connector/NodeJS 1.0.6 M5 has been released

MySQL Connector/Node.js is a new Node.js driver for use with the X DevAPI. This release, v1.0.6 M5, 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.

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/.

Note

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 http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

Functionality Added or Changed

  • Added support for validating the server certificate with
    a given CA and/or CRL.
  • Added support for creating TLS sessions with a URI or
    connection string.
  • Added support for creating IPv6 sessions with a URI or
    connection string.
  • Added support for single array or multiple argument
    function calls on the public API.

Bugs Fixed

  • Fixed issues with collection.bind(). (Bug #23236379)
  • Fixed parsing issues on URI and connection string
    corner-cases.
  • Updated behavior of collection.add([]) to avoid confusing
    exceptions.

Enjoy and thanks for the support!

On behalf of the MySQL/Oracle Release Engineering Team
Lars Tangvald

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
http://dev.mysql.com/doc/x-devapi-userguide/en/index.html. 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.

Note

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
http://dev.mysql.com/doc/refman/5.7/en/document-store.html.

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 npmjs.com

MySQL Connector/Node.JS 1.0.4 was recently released as a development milestone release. This is the first version available via npmjs.com. npmjs.com 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.

61

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

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

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:

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:

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

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

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.