Skip to main content

API and Configuration

SingleStore Node.js Driver is mostly API compatible with node-mysql2 and Node MySQL. Since SingleStore is MySQL wire-protocol compatible, most existing MySQL client code works seamlessly.

Known Incompatibilities​

One known incompatibility is that DECIMAL values are returned as strings whereas in Node MySQL they are returned as numbers. This includes the result of SUM() and AVG() functions when applied to INTEGER arguments. This is done deliberately to avoid loss of precision - see https://github.com/sidorares/node-mysql2/issues/935.

Migration from MySQL2​

SingleStore Node.js Driver is API-compatible with MySQL2, so migration is straightforward:

// Before (MySQL2)
const mysql = require('mysql2');
const connection = mysql.createConnection({...});

// After (SingleStore Node.js Driver)
const singlestore = require('singlestore_nodejs');
const connection = singlestore.createConnection({...});

// All existing queries work as-is!
info

If you find any incompatibility with node-mysql2 or issues specific to SingleStoreDB, please report via GitHub issue. We will address reported issues on priority basis.