Skip to content

v4.1.0

Choose a tag to compare

@eresende-nuodb eresende-nuodb released this 22 Oct 17:35
· 15 commits to master since this release

Node.js driver supports Node 22.14.0

It is now possible to set default properties for a connection requested from the connection Pool.
In particular, the poolConfig has a new property called connectionDefault. Here is an example setting
the all three key properties for a connection, autoCommit, readOnly, isolationLevel. Setting this
when a connection is requested from the Connection Pool, it will have these properties set to the
indicated default values. Without setting the connectionDefault, a connection will be in the state as it was last
used. The first time a connection is created, it will be set to the system defaults, if the developer changes
the settings during use, they remain in place until they are changed.

const connectionDefault = {
  autoCommit: true,
  readOnly: false,
  isolationLevel: "CONSISTENT READ",
};
 
const poolConfig = { // Define configuration object
  minAvailable: 2,
  connectionConfig,
  maxAge: 2000,
  checkTime: 10000,
  maxLimit: 2,
  connectionRetryLimit: 5,
  connectionDefault,
};

A REST feature is being made available as a preview feature, which means we encourage feedback if you
try it, but it is likely the feature will continue to evolve and be released with changes, the current
state is not likely to stay stable, so only use it when understanding it could incompatibly change in
future releases.

The Node.js driver can activate a REST server than can respond to various inquiries. For the time
being the intent to get metrics and configuration information within the particular instance of the driver.
The driver can be activated by setting the environment variable, NODE_NODEJS_REST to true or 1.
The default port is 9000, but can be controlled by the environment variable, NUODB_NODEJS_REST_PORT, set to whatever
Port number you prefer. Obviously whatever port is used, it should not be used for anything else.

To invoke a REST command, let’s say the process using the driver is running on the localhost, a curl command can be used like

curl -w '\r\n' http://localhost:9000/info/Pool

The commands will return a JSON structure with properties.

current support REST paths available are

/info/Pool – dumps out the stats and configuration of the Pools in a driver instance
/shutdown – closes the
/os – get process level stats
/env – get the environment variables for the process