Registry / database / monologue

monologue

JSON →
library0.9.3jsnpmunverified

Streamlined MySQL query builder for Node.js (v0.9.3, last updated 2015). Provides a fluent API for SELECT, INSERT, UPDATE, DELETE with chaining, nested WHERE grouping, and aggregate functions (count, sum, min, max). Includes .set() for conditional SET overrides and .values() for additional INSERT rows. Breaking change in 0.9.0: stringify() no longer auto-wraps arrays in parentheses. Unmaintained, no security updates, no TypeScript support. Key differentiator: extremely lightweight, zero dependencies, simple API.

npm install monologue
INSTALL
IMPORT
SIG · MONOLOGUE
M
monologue
databasejavascriptv0.9.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.

default
import monologue from 'monologue'
const monologue = require('monologue')
Package provides CommonJS default export; ESM import works but is unofficial. Use require for reliability.
Monologue
const monologue = require('monologue')
import { Monologue } from 'monologue'
Package does not export named symbols; only default export.
insert/select/update/delete
const mono = monologue().select('*', 'users').sql();
monologue.select('*', 'users')
Each call returns a new query builder instance; methods are chainable. Do not call static methods.

Demonstrates SELECT with WHERE, BETWEEN, ORDER, LIMIT; INSERT with single object; UPDATE with conditional SET using .set().

import monologue from 'monologue'; const query = monologue() .select('id', 'users') .where({ active: true }) .and('created_at').between('2020-01-01', '2020-12-31') .order('id', 'DESC') .limit(10); console.log(query.sql()); // SELECT `id` FROM `users` WHERE `active` = 1 AND `created_at` BETWEEN '2020-01-01' AND '2020-12-31' ORDER BY `id` DESC LIMIT 10 // INSERT example const insertQuery = monologue() .insert('users', { username: 'test', password: '1234' }); console.log(insertQuery.sql()); // INSERT INTO `users` (`username`, `password`) VALUES ('test', '1234') // UPDATE with conditional SET let updateQuery = monologue() .update('users', { name: 'John' }) .where({ id: 1 }); if (true) { updateQuery.set({ status: 'active' }); } console.log(updateQuery.sql()); // UPDATE `users` SET `name` = 'John', `status` = 'active' WHERE `id` = 1
Debug
Known issues
gotchastringify() no longer automatically wraps arrays with parentheses since v0.9.0. Pass arrays manually wrapped in parentheses if needed.
fix
Use .stringify([1,2,3]) → '(1,2,3)' manually.
affects: >=0.9.0
deprecatedPackage is unmaintained since 2015. No security updates, no tests with modern Node.js, no TypeScript definitions.
fix
Migrate to an actively maintained query builder (e.g., knex.js).
affects: all
gotchaUndocumented behavior: method chaining order does not affect SQL output; internal ordering is fixed regardless of call order.
fix
Be aware that .where() and .and() calls are reordered internally.
affects: all
gotchaNo built-in SQL injection protection; user input must be sanitized externally.
fix
Always escape or parameterize user input before passing to Monologue methods.
affects: all
Errors
Common errors & fixes
TypeError: monologue(...).select is not a function
Attempting to call .select() directly on the imported function instead of invoking it first.
fix
Use monologue().select('*', 'table') — always call monologue() first to create an instance.
ReferenceError: sql is not defined
Forgot to call .sql() at the end of the chain. Method returns query builder, not the SQL string.
fix
Chain .sql() to get the final SQL string: monologue().select('*', 'table').sql()
ER_PARSE_ERROR: You have an error in your SQL syntax; ... at line 1
Unescaped input causing SQL syntax error, or incorrect use of aggregate methods with wrong arguments.
fix
Sanitize inputs or use the correct method signature (e.g., .count('field') instead of .count('*') which was removed in 0.9.2).
Upgrade
Version history
0.9.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
monologue — npm install monologue · libregistry