Registry / database / mongowave

mongowave

JSON →
library0.15.0jsnpmunverified

Mongowave is a JavaScript MongoDB client that wraps the official mongodb driver, providing a simplified API with automatic timestamps, custom string IDs, and convenience defaults like $set updates and batch operations. Version 0.15.0 uses id instead of _id by default, returns full documents on create, and updates/deletes multiple documents per query. Released on npm, it requires mongowave and wraps the mongodb package. Differentiators include intuitive API, retry connection on fail, and minimal configuration.

npm install mongowave
INSTALL
IMPORT
SIG · MONGOWAVE
M
mongowave
databasejavascriptv0.15.0
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 (connection)
const connection = require('mongowave')
import connection from 'mongowave'
Package uses CommonJS; no ESM support detected.
connection (async function)
const db = await connection({ url: 'mongodb://...', name: 'mydb' })
const db = connection({ url: '...', name: 'mydb' })
Must await the connection function to get db instance.
db.collection methods
const result = await db('collection').find()
db.collection.find()
Collection is accessed via function call db('collection'), not as a property.

Connects to MongoDB using connection(), creates a document, finds documents, updates, and deletes.

const connection = require('mongowave'); async function main() { const db = await connection({ url: process.env.MONGO_URL ?? 'mongodb://localhost:27017', name: 'testdb', timestamps: true, simpleid: true, stringid: true }); const result = await db('users').create({ name: 'Alice', age: 30 }); console.log(result); // { id: '...', name: 'Alice', age: 30, created_at: ..., updated_at: ... } const users = await db('users').find({ age: { $gt: 25 } }); console.log(users); await db('users').update({ id: result.id }, { age: 31 }); await db('users').delete({ id: result.id }); } main().catch(console.error);
Debug
Known issues
breakingBy default, Mongowave uses 'id' instead of '_id' and generates custom string IDs (simpleid: true, id: cuid). To use MongoDB ObjectIDs and _id, set simpleid: false and id: false.
fix
db = await connection({ simpleid: false, id: false })
affects: >=0.0.0
deprecatedThe 'connection' options may include deprecated MongoDB driver options like useNewUrlParser and useUnifiedTopology, which are no longer needed in recent mongodb driver versions.
fix
Remove connection options or update to current mongodb driver defaults.
affects: >=0.15.0
gotchaPassing undefined as a field value omits the field in the document, unlike null which sets the field to null.
fix
Use null to explicitly set a field to null; use undefined to omit the field.
affects: >=0.0.0
gotchaThe update and delete methods affect all documents matching the query (multi: true by default). To affect only one, use the underlying mongodb driver or add a limit.
fix
For single update/delete, consider using db('collection').get() and then remove, or raw mongodb methods.
affects: >=0.0.0
gotchaThe create method with an array returns an array of full objects; with a single object, returns one full object. It does not distinguish between single and multiple based on arguments length.
fix
Always check the return type: array if input was array, else object.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: connection is not a function
Importing mongowave incorrectly or using it without awaiting.
fix
Use const connection = require('mongowave'); then await connection({...});
Cannot find module 'mongowave'
Package not installed.
fix
Run: npm install mongowave
TypeError: db(...).find is not a function
Trying to call db.collection incorrectly (e.g., db.collection instead of db('collection')).
fix
Use db('collection') as a function call, not a property access.
MongoError: Authentication failed
Incorrect MongoDB credentials or connection string.
fix
Ensure url includes authentication: mongodb://user:pass@host:port/db
Upgrade
Version history
0.15.0latest on npm
Audit
Dependencies
mongodbrequiredUnderlying MongoDB driver for database operations
Agent activity
6 hits · last 30 days
node
6
Resources
mongowave — npm install mongowave · libregistry