{"id":43851,"library":"smart-mysql","title":"smart-mysql","description":"smart-mysql is a Node.js library that allows developers to interact with MySQL databases using NoSQL-style commands, such as insert, update, delete, and select with simple JavaScript objects, abstracting away raw SQL. The current version is 0.9.19, with no recent updates since 2015, indicating it is likely abandoned. It provides a MongoDB-like API familiar to developers transitioning from NoSQL databases, but lacks modern features, proper error handling, and is not production-ready. It differs from alternatives like knex or sequelize by being lighter and simpler, but is largely unmaintained and insecure.","status":"abandoned","version":"0.9.19","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","mysql","smart","nosql"],"install":[{"cmd":"npm install smart-mysql","lang":"bash","label":"npm"},{"cmd":"yarn add smart-mysql","lang":"bash","label":"yarn"},{"cmd":"pnpm add smart-mysql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Underlying driver for MySQL connections","package":"mysql","optional":false}],"imports":[{"note":"Library does not support ES modules; only CommonJS require works.","wrong":"import smart_mysql from 'smart-mysql';","symbol":"smart_mysql","correct":"const smart_mysql = require('smart-mysql');"},{"note":"Must use new keyword to instantiate.","wrong":"const db = smart_mysql({...});","symbol":"new smart_mysql","correct":"const db = new smart_mysql({ host: 'localhost', user: 'root', password: '', charset: 'utf8_unicode_ci', database: 'avl' });"},{"note":"Method is named collection, not table; table is a separate query method.","wrong":"db.table('user');","symbol":"db.collection","correct":"db.collection('user');"}],"quickstart":{"code":"const smart_mysql = require('smart-mysql');\n\nconst db = new smart_mysql({\n  host: process.env.DB_HOST ?? 'localhost',\n  user: process.env.DB_USER ?? 'root',\n  password: process.env.DB_PASS ?? '',\n  charset: 'utf8_unicode_ci',\n  database: process.env.DB_NAME ?? 'test'\n});\n\ndb.collection('user').insert({ name: 'John', age: 30 }, function(done) {\n  if (done) console.log('Insert successful');\n});\n\ndb.collection('user').table(['id', 'name'], { age: 30 }, function(data) {\n  console.log('Selected:', data);\n});\n\ndb.collection('user').update({ name: 'Jane' }, { age: 30 }, function(done) {\n  if (done) console.log('Update done');\n});\n\ndb.collection('user').delete({ id: 1 }, function(done) {\n  if (done) console.log('Deleted');\n});","lang":"javascript","description":"Demonstrates basic CRUD operations: insert, select with table, update, and delete using NoSQL-style objects."},"warnings":[{"fix":"Do not expect callback to return rows or error objects; it only returns truthy/falsy.","message":"Callbacks use a single boolean parameter indicating success, not results or error objects.","severity":"gotcha","affected_versions":"*"},{"fix":"Use db.collection('user').insert({...}) for single inserts, not Insert.","message":"The Insert method (capital I) has different signature than insert (lowercase). Insert expects an array as first element.","severity":"gotcha","affected_versions":"*"},{"fix":"Avoid using this library in production. Migrate to a maintained ORM with parameterized queries.","message":"Syntax for update and delete conditions is not escaped; vulnerable to SQL injection.","severity":"deprecated","affected_versions":"*"},{"fix":"Use an actively maintained ORM like knex or sequelize.","message":"The library is no longer maintained and may not work with Node.js versions > 10 or newer MySQL versions.","severity":"breaking","affected_versions":">=0.9.19"}],"env_vars":null,"search_vec":"'0.9.19':43 '2015':49 'abandon':54 'abstract':35 'allow':12 'altern':85 'api':61 'away':36 'command':23 'current':40 'databas':18,68 'delet':28 'develop':13,64 'differ':83 'error':74 'familiar':62 'featur':72 'handl':75 'indic':50 'insecur':100 'insert':26 'interact':15 'javascript':33,101 'knex':87 'lack':70 'larg':97 'librari':10 'lighter':92 'like':53,60,86 'modern':71 'mongodb':59 'mongodb-lik':58 'mysql':3,6,17,102 'node.js':9 'nosql':21,67,104 'nosql-styl':20 'object':34 'product':80 'production-readi':79 'proper':73 'provid':56 'raw':37 'readi':81 'recent':46 'select':30 'sequel':89 'simpl':32 'simpler':94 'sinc':48 'smart':2,5,103 'smart-mysql':1,4 'sql':38 'style':22 'transit':65 'unmaintain':98 'updat':27,47 'use':19 'version':41","created_at":"2026-06-05T17:01:47.280013+00:00","updated_at":"2026-06-05T17:01:47.280013+00:00","problems":[{"fix":"const db = new smart_mysql({...});","cause":"Forgot 'new' keyword when instantiating the class.","error":"TypeError: smart_mysql is not a constructor"},{"fix":"Run 'npm install smart-mysql' and ensure node_modules is present.","cause":"Library not installed or Node.js cannot resolve the require.","error":"Cannot find module 'smart-mysql'"},{"fix":"Use lowercase db.collection('user').insert({data}, callback).","cause":"Typo in method name or using Insert with capital I incorrectly.","error":"TypeError: db.collection(...).insert is not a function"},{"fix":"Check database credentials and ensure table exists. Add error logging to callback.","cause":"MySQL connection error or missing database/table.","error":"“done” callback never fires or returns undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"smart-mysql","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}