Registry / database / databank-mongodb

databank-mongodb

JSON →
library1.0.1jsnpmunverified

Databank driver for MongoDB, version 1.0.1. This package provides a MongoDB backend for the Databank abstraction layer, allowing developers to use MongoDB collections as Databank stores with schema mapping, indexing, and atomic operations. It supports replica sets, authentication, and custom schemas. Release cadence is low; last release 2015. Key differentiator: bridges Databank interface with MongoDB, handling type wrapping for arrays and integers.

npm install databank-mongodb
INSTALL
IMPORT
SIG · DATABANK-MONGODB
D
databank-mongodb
databasejavascriptv1.0.1
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.

Databank
var Databank = require('databank').Databank;
import { Databank } from 'databank';
CommonJS only, no ESM support.
get
var db = Databank.get('mongodb', {});
var db = Databank.get('mongo', {});
Driver name is 'mongodb', not 'mongo'.
Databank.get
Databank.get('mongodb', options)
new Databank.Mongo(options)
Databank uses factory method, not constructor.

Connects to MongoDB using Databank factory, creates a person entry with schema and indices.

var Databank = require('databank').Databank; var db = Databank.get('mongodb', { host: process.env.DB_HOST || 'localhost', port: process.env.DB_PORT || 27017, dbname: process.env.DB_NAME || 'test', schema: { person: { pkey: 'username', indices: ['age'] } }, checkSchema: true }); db.connect({}, function(err) { if (err) throw err; db.create('person', 'evanp', { username: 'evanp', age: 43 }, function(err, obj) { console.log('Created:', obj); db.close(); }); });
Debug
Known issues
breakingDepends on Node >=0.6.x; incompatible with modern Node versions.
fix
Use versions >=0.10.x or consider alternative drivers.
affects: >=1.0
gotchaArrays and integers are wrapped with _v and _s fields when stored.
fix
Read back using databank methods; direct MongoDB queries will see raw structure.
affects: >=0.1
deprecatedLast release in 2015; no updates for MongoDB 3.6+ features.
fix
Consider switching to mongoose or native mongodb driver.
affects: >=1.0
gotchaDriver name is 'mongodb', not 'mongo'.
fix
Use Databank.get('mongodb', {}).
affects: >=0.1
Errors
Common errors & fixes
Error: Cannot find module 'databank'
Missing databank core package
fix
npm install databank
TypeError: Databank.get is not a function
Incorrect import of databank module
fix
Use require('databank').Databank
MongoError: auth fails
Invalid credentials or MongoDB not configured for auth
fix
Set dbuser and dbpass options correctly
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
databankrequiredCore Databank library required for driver interface
mongodbrequiredMongoDB Node.js driver for database operations
Agent activity
10 hits · last 30 days
node
8
Resources
databank-mongodb — npm install databank-mongodb · libregistry