diff --git a/lib/bson/objectid.js b/lib/bson/objectid.js index 4a52ab66..1e30a7f9 100644 --- a/lib/bson/objectid.js +++ b/lib/bson/objectid.js @@ -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);