Skip to content

Commit

Permalink
fix(objectid): if pid is 1, use random value
Browse files Browse the repository at this point in the history
  • Loading branch information
jiho-kr authored and mbroadst committed Aug 24, 2017
1 parent 6dc72fd commit e188ae6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bson/objectid.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ ObjectID.prototype.generate = function(time) {
}

// Use pid
var pid = (typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF;
var pid = (typeof process === 'undefined' || process.pid === 1 ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF;
var inc = this.get_inc();
// Buffer used
var buffer = new Buffer(12);
Expand Down

0 comments on commit e188ae6

Please sign in to comment.