Registry / database / node-data-mapper-mysql

node-data-mapper-mysql

JSON →
library1.1.22jsnpmunverified

MySQL driver for the node-data-mapper library, version 1.1.22. This package provides MySQL-specific implementation for database interactions using node-data-mapper. It wraps the mysql2 driver and supports CRUD operations, streaming, and parameterized queries. Note that this package appears to be in maintenance mode with no recent updates and very limited documentation. It is intended for use with the node-data-mapper framework and is not standalone. Last updated around 2018, with an engine requirement of Node >=6.9.1.

npm install node-data-mapper-mysql
INSTALL
IMPORT
SIG · NODE-DATA-MAPPER-M
N
node-data-mapper-mysql
databasejavascriptv1.1.22
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MySQLDriver
const { MySQLDriver } = require('node-data-mapper-mysql');
const MySQLDriver = require('node-data-mapper-mysql');
This package is CommonJS-only; named export. Using default import will return an object.
MySQLDriver
import { MySQLDriver } from 'node-data-mapper-mysql';
import MySQLDriver from 'node-data-mapper-mysql';
ESM import works with a bundler or Node 12+ using --experimental-modules. Default import is incorrect.
DataMapper
const { DataMapper } = require('node-data-mapper'); const { MySQLDriver } = require('node-data-mapper-mysql');
const DataMapper = require('node-data-mapper-mysql').DataMapper;
DataMapper is from the core package, not the MySQL driver.

This example shows how to instantiate the DataMapper with a MySQL driver and perform a simple SELECT query.

const { DataMapper } = require('node-data-mapper'); const { MySQLDriver } = require('node-data-mapper-mysql'); const config = { client: 'mysql', connection: { host: process.env.DB_HOST || 'localhost', user: process.env.DB_USER || 'root', password: process.env.DB_PASS || '', database: process.env.DB_NAME || 'test' } }; const dm = new DataMapper(new MySQLDriver(config)); dm.find('users') .where({ id: 1 }) .execute() .then(results => { console.log('User:', results); }) .catch(err => { console.error('Error:', err); });
Debug
Known issues
deprecatedThis package is no longer actively maintained. Last release in 2018.
fix
Consider using a more modern ORM like Sequelize, TypeORM, or Knex.js.
affects: *
breakingRequires Node.js >=6.9.1. May not work on newer Node versions without updating dependencies.
fix
Update node-data-mapper-mysql or use a compatible Node version.
affects: >=12.0.0
gotchaNo TypeScript typings are provided. Manual type declarations needed in TypeScript projects.
fix
Create a .d.ts file or use @ts-ignore.
affects: *
gotchaThe mysql2 dependency may have security vulnerabilities if not updated. Check npm audit.
fix
Update mysql2 in your package.json or run npm audit fix.
affects: *
gotchaDirect use of connection pooling from mysql2 is not exposed; configure via MySQLDriver options.
fix
Refer to node-data-mapper documentation for connection settings.
affects: *
Errors
Common errors & fixes
Cannot find module 'node-data-mapper-mysql'
Package not installed.
fix
Run 'npm install node-data-mapper-mysql'.
TypeError: MySQLDriver is not a constructor
Incorrect import or require syntax.
fix
Ensure you use const { MySQLDriver } = require('node-data-mapper-mysql');
ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'
Invalid database credentials.
fix
Check DB_HOST, DB_USER, DB_PASS, DB_NAME environment variables or config object.
Upgrade
Version history
1.1.22latest on npm
Audit
Dependencies
mysql2requiredRequired for MySQL database connectivity.
node-data-mapperrequiredCore library providing the base DataMapper class and utilities.
Agent activity
4 hits · last 30 days
node
4
Resources
node-data-mapper-mysql — npm install node-data-mapper-mysql · libregistry