Registry / database / deepbase-mongodb

deepbase-mongodb

JSON →
library3.6.9jsnpmunverified

MongoDB driver for DeepBase, a reactive nested-object database. Version 3.6.9 is the latest stable release. It stores DeepBase data in MongoDB collections using upsert logic, supports atomic $inc/$dec operations, dot-notation nested updates, and multi-driver setups (e.g., MongoDB primary with JSON backup). Requires the deepbase package as a peer dependency. Well-suited for production applications needing scalability and complex queries, with TypeScript types included.

npm install deepbase-mongodb
INSTALL
IMPORT
SIG · DEEPBASE-MONGODB
D
deepbase-mongodb
databasejavascriptv3.6.9
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.

MongoDriver
import MongoDriver from 'deepbase-mongodb';
import { MongoDriver } from 'deepbase-mongodb';
Default export only; named export will be undefined at runtime.
MongoDriver
const MongoDriver = require('deepbase-mongodb').default;
const MongoDriver = require('deepbase-mongodb');
CommonJS requires accessing the .default property because the package is ESM-first.
DeepBase
import DeepBase from 'deepbase';
import DeepBase from 'deepbase-mongodb';
DeepBase is the core package, not part of this driver. Both packages are needed.

Shows how to instantiate DeepBase with the MongoDriver, connect to MongoDB, and perform basic get/set operations.

import DeepBase from 'deepbase'; import MongoDriver from 'deepbase-mongodb'; const db = new DeepBase(new MongoDriver({ url: process.env.MONGO_URL ?? 'mongodb://localhost:27017', database: 'myapp', collection: 'documents' })); await db.connect(); await db.set('users', 'alice', { name: 'Alice', age: 30 }); const alice = await db.get('users', 'alice'); console.log('Alice:', alice);
Debug
Known issues
breakingThe package switched to ESM-only in v3.0.0. Older CommonJS require() patterns no longer work without .default.
fix
Use import MongoDriver from 'deepbase-mongodb' for ESM, or const MongoDriver = require('deepbase-mongodb').default for CJS.
affects: >=3.0.0
deprecatedUsing collection option without also setting database may lead to unexpected defaults in future versions.
fix
Always provide both database and collection options explicitly.
affects: >=3.6.0
gotchaThe driver uses upsert by default for set operations. If a key is missing, it creates a new document. This can accidentally overwrite data if not careful.
fix
Verify keys before writing or use transactions/check-exists logic.
affects: >=1.0.0
gotchaNested operations using dot notation may conflict with MongoDB's interpretation of dots. Ensure keys do not contain dots to avoid unexpected document structure.
fix
Avoid dots in key names, or escape them if necessary.
affects: >=1.0.0
breakingThe base/database option was renamed to database in v2.0.0. The old base option is no longer supported.
fix
Use database: 'myapp' instead of base: 'myapp'.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'deepbase'
Missing peer dependency deepbase is not installed.
fix
Run: npm install deepbase
MongoDB connection error: MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
MongoDB server is not running or not accessible at the given URL.
fix
Start MongoDB or adjust the url option. For local development: docker run -d -p 27017:27017 --name mongodb mongodb/mongodb-community-server:latest
TypeError: MongoDriver is not a constructor
CommonJS require without .default on ESM-only package.
fix
Use: const MongoDriver = require('deepbase-mongodb').default;
Error: Invalid scheme, expected mongodb or mongodb+srv
The url option is missing or has an unsupported protocol.
fix
Provide a valid MongoDB connection string starting with mongodb:// or mongodb+srv://
Upgrade
Version history
3.6.9latest on npm
Audit
Dependencies
deepbaserequiredRequired as peer dependency; this package provides the MongoDB driver for the DeepBase database framework.
Agent activity
8 hits · last 30 days
node
8
Resources
deepbase-mongodb — npm install deepbase-mongodb · libregistry