A Bedrock module that creates a simple MongoDB database and provides an easy API for creating and working with its collections. Current stable version is 8.5.0, targeting Node.js >=10 and requiring peer dependency bedrock ^4.3.0. It simplifies MongoDB setup in Bedrock applications with opinionated configuration for database name, host, port, authentication, and connection options. Supports URL-based configuration and Mongoose-like collection management via openCollections. Compared to raw mongodb driver usage, it integrates with Bedrock events and configuration system, handling database creation and user setup on startup.
npm install bedrock-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic setup: configure MongoDB connection, open a collection after database ready event, and query it.
Upgrade to Node.js >=10 and bedrock ^4.3.0.
Replace `connectOptions.authDB` with `connectOptions.authSource`.
Register event handler before bedrock.start(); otherwise collections may not be opened.
Access collections only inside the openCollections callback or after it completes.
Run 'npm install bedrock-mongodb bedrock' and ensure both are in node_modules.
Check config.mongodb.username/password and connectOptions.authSource; ensure MongoDB user exists.
Use `const database = require('bedrock-mongodb');`