Registry / database / jugglingdb-mysql

jugglingdb-mysql

JSON →
library0.2.3jsnpmunverified

MySQL adapter for JugglingDB, an ORM for Node.js. This package (version 0.2.3) provides MySQL database support for JugglingDB 0.2.x. It supports data type mappings with custom column types (e.g., tinyint, float, decimal, varchar, text, enum, datetime, timestamp), OR/IN operators in queries, and optional connection parameters like password and collation (defaults to utf8mb4_general_ci). The project is archived and no longer maintained, but may still be used with legacy JugglingDB applications. It is not compatible with LoopBack or newer ORMs.

npm install jugglingdb-mysql
INSTALL
IMPORT
SIG · JUGGLINGDB-MYSQL
J
jugglingdb-mysql
databasejavascriptv0.2.3
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.

Schema
var Schema = require('jugglingdb').Schema; var schema = new Schema('mysql', { database: 'myapp_test', username: 'root' });
var jugglingdb = require('jugglingdb-mysql');
The adapter is loaded by passing 'mysql' to the Schema constructor, not by requiring the adapter directly.
schema.define
var Animal = schema.define('Animal', { name: String, type: String });
schema.define('Animal', ...) with incorrect primary key or missing id property
Models are defined via schema.define(). Primary key is automatically added as 'id' unless specified.
schema.EnumFactory
var MOOD = schema.EnumFactory('glad', 'sad', 'mad');
var MOOD = require('jugglingdb-mysql').EnumFactory;
EnumFactory is a method on the schema instance, not exported by the adapter.

Connects to MySQL using JugglingDB, defines a model with custom data types and enum, performs automigrate, create, and query with OR operator.

var Schema = require('jugglingdb').Schema; var schema = new Schema('mysql', { database: 'myapp_test', username: 'root', password: process.env.MYSQL_PASSWORD || '' }); var Animal = schema.define('Animal', { name: { type: String, limit: 50 }, type: { type: String, dataType: 'char', limit: 20 }, size: { type: String, dataType: 'enum', values: ['small', 'medium', 'large'] }, birth: Date }); schema.automigrate(function() { Animal.create({ name: 'Penny', type: 'cat', size: 'medium', birth: new Date() }, function(err, animal) { if (err) throw err; console.log('Created:', animal); }); }); Animal.all({ where: { name: 'Penny', or: [{ type: 'cat' }, { size: 'medium' }] } }, function(err, animals) { if (err) throw err; animals.forEach(function(a) { console.log('Found:', a.name); }); });
Debug
Known issues
deprecatedJugglingDB-MySQL is deprecated and no longer maintained. The JugglingDB project has been superseded by LoopBack.
fix
Migrate to LoopBack or use a modern ORM like Sequelize or TypeORM.
affects: all
breakingRequires jugglingdb@0.2.x specific. Incompatible with newer jugglingdb versions or LoopBack.
fix
If using jugglingdb, ensure version is 0.2.x. For newer projects, use LoopBack or another ORM.
affects: 0.2.3
gotchaEnumFactory usage requires schema instance; the adapter does not export EnumFactory directly.
fix
Use schema.EnumFactory() after creating the schema, not from the adapter package.
affects: all
gotchaThe OR operator must be an array of objects in the where clause. Each object's keys are treated as AND conditions.
fix
Use { or: [ { field: value }, ... ] } syntax and remember that properties inside each object are ANDed.
affects: all
gotchaDefault collation is utf8mb4_general_ci which may affect charset encoding. Not all MySQL servers support utf8mb4.
fix
Explicitly set collation if needed (e.g., collation: 'utf8_general_ci'). For older MySQL, use utf8.
affects: all
Errors
Common errors & fixes
Cannot find module 'jugglingdb-mysql'
The adapter is not meant to be required directly; it is loaded via the 'mysql' adapter name in jugglingdb.
fix
Do not require('jugglingdb-mysql'); instead, require('jugglingdb') and use new Schema('mysql', ...).
TypeError: schema.EnumFactory is not a function
schema.EnumFactory is a method of the jugglingdb Schema instance, not of the mysql adapter.
fix
Ensure you have required jugglingdb and created a schema instance before calling schema.EnumFactory.
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server
MySQL 8 uses caching_sha2_password by default, while the mysql npm package may expect mysql_native_password.
fix
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; or update mysql package.
Upgrade
Version history
0.2.3latest on npm
Audit
Dependencies
jugglingdbrequiredCore ORM library required; adapter registers itself with JugglingDB's Schema.
mysqloptionalThe mysql npm package is used internally for database connections.
Agent activity
5 hits · last 30 days
node
4
Resources
jugglingdb-mysql — npm install jugglingdb-mysql · libregistry