Skip to content

Commit e188ae6

Browse files
jiho-krmbroadst
authored andcommitted
fix(objectid): if pid is 1, use random value
1 parent 6dc72fd commit e188ae6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/bson/objectid.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ ObjectID.prototype.generate = function(time) {
137137
}
138138

139139
// Use pid
140-
var pid = (typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF;
140+
var pid = (typeof process === 'undefined' || process.pid === 1 ? Math.floor(Math.random() * 100000) : process.pid) % 0xFFFF;
141141
var inc = this.get_inc();
142142
// Buffer used
143143
var buffer = new Buffer(12);

0 commit comments

Comments
 (0)