MySQL Forums
Forum List  »  Announcements

MySQL Connector/Node.js 8.0.13 has been released
Posted by: Jocelyn Ramilison
Date: October 22, 2018 09:49AM

Dear MySQL users,

MySQL Connector/Node.js is a new Node.js driver for use with the X
DevAPI. This release, v8.0.13, 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.13 (2018-10-22, General availability)

Functionality Added or Changed

     * To go with the existing asynchronous
       mysqlx.getSession(conn_str) method, a new synchronous
       mysqlx.getClient(conn_str, options) method was added that
       creates a connection pool handler that provides an
       asynchronous getSession() method to create and retrieve
       connections from the pool. The collection pooling options
       are:

          + enabled: enables or disables connection pooling;
            boolean and defaults to true.

          + maxSize: maximum number of connections available in
            the pool; positive integer and defaults to 25.

          + maxIdleTime: maximum number of milliseconds a
            connection can be idle in the queue before being
            closed; integer >= 0 and defaults to 0 (infinite).

          + queueTimeout: maximum number of milliseconds a
            request will wait for a connection to become
            available; integer >= 0 and defaults to 0
            (infinite).
            This is different than connectTimeout that's used
            for non-pooling. In a pooling scenario, there might
            already be connections in the pool and queueTimeout
            controls how long to wait for a connection in the
            pool.
       Example usage:
       var mysqlx = require('@mysql/xdevapi')
       var client = mysqlx.getClient(
         { user: 'root', host: 'localhost', port: 33060 },
         { pooling: { enabled: true, maxIdleTime: 5000, maxSize: 25, queueTimeout: 20000 } }
       );

       client.getSession()
         .then(session => {
           console.log(session.inspect())
           return session.close() // the connection becomes idle in the client pool
         })
         .then(() => {
           return client.getSession()
         })
         .then(session => {
           console.log(session.inspect())
           return client.close() // closes all connections and destroys the pool
         })

       Closing a session attached to the pool makes the
       connection available in the pool for subsequent
       getSession() calls, while closing (destroying) the pool
       effectively closes all server connections.

     * Added a connection timeout query parameter. This defines
       the length of time (milliseconds) the client waits for a
       MySQL server to become available in the given network
       addresses. It was added to both the mysqlx.getSession()
       (non-pooling sessions) and mysqlx.getClient() (pooling
       sessions) interfaces. This option defaults to 10000 (10
       seconds). The value 0 disables the timeout so the client
       will wait until the underlying socket (platform
       dependent) times out.
       Similar to other option formatting rules, this option
       defined as connection-timeout (kebab-case) for URI
       definitions and connectionTimeout (camelCase) for plain
       JavaScript configuration objects.
       Example usage:
       const mysqlx = require('@mysql/xdevapi');
       var client = mysqlx.getClient('root@localhost?connect-timeout=5000')
       client.getSession()
           .catch(err => {
               console.log(err.message) // "Connection attempt to the server was aborted. Timeout of 5000 ms was exceeded."
           })

       // Or

       const mysqlx = require('@mysql/xdevapi');
       var client = mysqlx.getClient('mysqlx://root:passwd@[localhost:33060, 127.0.0.1:33060]?connect-timeout=5000')
       client.getSession()
           .catch(err => {
               // connection could not be established after 10 seconds (5 seconds for each server)
               console.log(err.message); // All server connection attempts we re aborted. Timeout of 5000 ms was exceeded for each selected server.
           });

       In a multi-host scenario, the connect-timeout value
       applies to each individual host.


Bugs Fixed

     * Improved the handling of X Protocol global notices by
       properly logging and then ignoring non-fatal errors, and
       making the connection unusable for subsequent operations
       in the case of a fatal error. (Bug #28653781)

     * Calling getCollationName() on non-textual fields, such as
       INT, threw the following error "TypeError: Cannot read
       property 'collation' of undefined". (Bug #28608923)

     * The fields() method did not function with valid
       expressions generated by the expr() method. (Bug
       #28409639)

     * The returned Session.inspect() object now includes the
       'user' property in addition to the 'dbUser' property but
       containing the same value. (Bug #28362115) 

On Behalf of the MySQL/Oracle Release Engineering Team,
Hery Ramilison

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL Connector/Node.js 8.0.13 has been released
1862
October 22, 2018 09:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.