Registry / database / bedrock-credentials-mongodb

bedrock-credentials-mongodb

JSON →
library3.3.2jsnpmunverified

This package provides credential storage for the Bedrock framework using MongoDB. Current stable version is 3.3.2. It is a core module in the Bedrock ecosystem for managing verifiable credentials with MongoDB as the backend. It depends on bedrock, bedrock-permission, and bedrock-mongodb. Alternatives exist for other databases, but this is the standard for MongoDB integration with Bedrock. Release cadence is tied to Bedrock updates, with breaking changes handled through peer dependency ranges.

npm install bedrock-credentials-mongodb
INSTALL
IMPORT
SIG · BEDROCK-CREDENTIAL
B
bedrock-credentials-mongodb
databasejavascriptv3.3.2
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
const store = require('bedrock-credentials-mongodb');
import store from 'bedrock-credentials-mongodb';
Package is CommonJS-only; ESM import is not supported. The export is a module object with methods.
insert
const { insert } = require('bedrock-credentials-mongodb');
import { insert } from 'bedrock-credentials-mongodb';
Destructuring works in CJS. ESM destructured import may cause runtime error in Node < 16.
get
const { get } = require('bedrock-credentials-mongodb');
const get = require('bedrock-credentials-mongodb').get;
Both patterns are valid, but destructuring is idiomatic in modern CJS.

Shows basic operations: insert, get, and count credentials using CommonJS require and callback style.

const bedrock = require('bedrock'); const store = require('bedrock-credentials-mongodb'); // assume 'actor' is a valid bedrock permission actor // assume 'credential' is a credential object // assume 'callback' is error-first callback // insert a credential store.insert(actor, credential, (err) => { if (err) return console.error('Insert failed:', err); console.log('Credential inserted'); }); // get a credential by query store.get(actor, {id: 'credential-id'}, (err, credential) => { if (err) return console.error('Get failed:', err); console.log('Retrieved credential:', credential); }); // count credentials matching a query store.count(actor, {type: 'VerifiableCredential'}, (err, count) => { if (err) return console.error('Count failed:', err); console.log('Count:', count); });
Debug
Known issues
breakingBedrock peer dependency requires bedrock ^1.0.0, which may have breaking changes between major versions.
fix
Ensure bedrock version matches the peer dependency requirement exactly.
affects: >=3.0.0
breakingbedrock-mongodb peer dependency range '3.x - 5.x' means breaking changes in that range are not all compatible; test with your specific version.
fix
Lock bedrock-mongodb to a specific version that works with your deployment.
affects: >=3.0.0
gotchaAll callbacks must follow error-first pattern; omitting error handling can cause silent failures.
fix
Always check the error parameter in callbacks.
affects: >=0.0.0
gotchaThe 'actor' parameter must have proper permissions; otherwise operations will fail with permission errors.
fix
Ensure the actor is authorized via bedrock-permission before calling store methods.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'bedrock-credentials-mongodb'
Package not installed or missing from node_modules.
fix
Run 'npm install bedrock-credentials-mongodb' and ensure package.json includes it.
TypeError: store.insert is not a function
Incorrect import (e.g., default import vs named import in CJS).
fix
Use 'const store = require('bedrock-credentials-mongodb');' and then 'store.insert(...)'.
Error: Missing required module 'bedrock-permission'
Peer dependency not installed.
fix
Install peer dependencies: 'npm install bedrock bedrock-permission bedrock-mongodb'.
Upgrade
Version history
3.3.2latest on npm
Audit
Dependencies
bedrockrequiredCore framework runtime dependency
bedrock-permissionrequiredPermission management for credential operations
bedrock-mongodbrequiredMongoDB driver integration
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
bedrock-credentials-mongodb — npm install bedrock-credentials-mongodb · libregistry