Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: node_js
node_js:
- 0.10
- 0.8
- 0.6
- 0.4
- 0.6
4 changes: 2 additions & 2 deletions lib/objectid.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = ObjectId
// from docs: This is the first three bytes of the (md5) hash of the machine host name, or of the mac/network address,
// or the virtual machine id.

var machineHash = crypto.createHash('md5').update(os.hostname()).digest('binary')
var machineHash = crypto.createHash('md5').update(os.hostname()).digest()

// Pre-cache the machine hash / pid
var machineAndPid = [
Expand Down Expand Up @@ -92,4 +92,4 @@ try {
}
return buffer
}
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"nodeunit": "0.6.4"
},
"scripts": {
"test": "node_modules/.bin/nodeunit test/bson-test.js test/mongo-test.js"
"test": "node_modules/.bin/nodeunit test/bson-test.js test/mongo-test.js test/objectid.js"
},
"engines": {
"node": ">=0.4.0"
}
}
}
11 changes: 11 additions & 0 deletions test/objectid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var BSON = require('../buffalo')

module.exports = {
"machine id part of ObjectID is not zero": function(test) {
var objid = new BSON.ObjectId();
test.ok(!(objid.bytes[4] == 0x00 &&
objid.bytes[5] == 0x00 &&
objid.bytes[6] == 0x00))
test.done()
},
}