Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Don't attempt to get ObjectId from bson embedded in mongodb package #2

merged 1 commit into from

2 participants


Make bson a dep of this project and access it directly - leads to all tests passing.


Thanks evdb, what are the advantages of using the bson requirement over the one in mongodb?


The code will work with more recent mongodb packages, and test suite will pass :)

If I make sure that the version of mongodb specified as the minimum in package.json is used it all passes fine:

cd pow-mongodb-fixtures
npm install mongodb@0.9.7-1.4
npm install .
nodeunit test/
# all tests pass

But if you use the latest mongodb (currently 0.9.9-7) then the tests don't pass:

npm install mongodb@latest
nodeunit test/

    throw err;
Error: Cannot find module 'mongodb/lib/mongodb/bson/bson'

I'm guessing that the internal layout of mongodb changed somehow, but have not investigated it. Adding bson as a dep sidesteps the issue.

@powmedia powmedia merged commit 1dff0bd into powmedia:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +2 −1  package.json
  2. +1 −1  src/index.js
3  package.json
@@ -11,7 +11,8 @@
"dependencies": {
"async": "0.1.15",
"mongodb": ">=0.9.7-1.4",
- "underscore": ">=1.2.2"
+ "underscore": ">=1.2.2",
+ "bson": ">=0.0.4",
"devDependencies": {
"nodeunit": "0.6.4"
2  src/index.js
@@ -1,7 +1,7 @@
var fs = require('fs'),
mongo = require('mongodb'),
- ObjectID = require('mongodb/lib/mongodb/bson/bson').ObjectID,
+ ObjectID = require('bson').ObjectID,
async = require('async'),
_ = require('underscore');
Something went wrong with that request. Please try again.