Registry / database / mongodb-bluebird

mongodb-bluebird

JSON →
library0.1.2jsnpmunverified

A thin wrapper around the node-mongodb-native driver that returns Bluebird promises instead of callbacks or raw promises. Version 0.1.2 is the latest and only release. It adds convenience methods like findById and automatic ObjectId conversion for _id fields. Not actively maintained; superseded by the built-in promise support in the MongoDB driver (using native Promise or Bluebird via options).

npm install mongodb-bluebird
INSTALL
IMPORT
SIG · MONGODB-BLUEBIRD
M
mongodb-bluebird
databasejavascriptv0.1.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.

mongo
import mongo from 'mongodb-bluebird'
const mongo = require('mongodb-bluebird').default
This package only provides a default export. Do not use named imports; there are no named exports.
mongo (CommonJS)
const mongo = require('mongodb-bluebird')
var mongo = require('mongodb-bluebird').default
In CommonJS, the default export is accessed via require directly; no .default is needed.
mongodb (raw driver)
import { mongodb } from 'mongodb-bluebird'
const mongodb = require('mongodb-bluebird')
The raw driver is available as a named export `mongodb`. Do not confuse with the default export.

Connects to MongoDB, queries all documents from the 'users' collection, logs them, and closes the connection.

import mongo from 'mongodb-bluebird'; const uri = process.env.MONGO_URI ?? 'mongodb://localhost:27017/mydb'; mongo.connect(uri) .then(db => { const users = db.collection('users'); return users.find().then(usersList => { console.log(usersList); return db.close(); }); }) .catch(err => console.error('Connection error:', err));
Debug
Known issues
deprecatedPackage is no longer maintained; use MongoDB driver's native promise support instead.
fix
Use `const MongoClient = require('mongodb').MongoClient;` with `useNewUrlParser` and `useUnifiedTopology` options, and either native promises or Bluebird via `promiseLibrary` option.
affects: *
gotchaThe package does not expose TypeScript typings; all types are any.
fix
Manually define types or use `@types/mongodb` and cast as needed.
affects: *
gotchaAutomatic ObjectId conversion for _id may silently mutate data if _id is not a valid ObjectId string.
fix
Disable ObjectId conversion with `db.collection('users', { ObjectId: false })` or validate _id strings beforehand.
affects: *
gotchaThe package uses an old version of the MongoDB driver (likely 2.x), which has breaking changes from 3.x+.
fix
Upgrade to a modern MongoDB driver with promise support to avoid deprecated API errors.
affects: *
Errors
Common errors & fixes
Cannot find module 'mongodb-bluebird'
The package is not installed or is misspelled.
fix
Run `npm install mongodb-bluebird` and ensure the package name is correct.
TypeError: mongo.connect is not a function
Incorrect import style; used named import instead of default.
fix
Use `import mongo from 'mongodb-bluebird'` or `const mongo = require('mongodb-bluebird')`.
TypeError: db.collection is not a function
Connection failed and db is undefined.
fix
Ensure the MongoDB server is running and the URI is correct. Add error handling on the connect promise.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies
mongodbrequiredThe native MongoDB driver is the core database driver that mongodb-bluebird wraps.
bluebirdrequiredBluebird promise library is used instead of native promises.
Agent activity
9 hits · last 30 days
node
8
Resources
mongodb-bluebird — npm install mongodb-bluebird · libregistry