/etc/conf.d # netstat -nltp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 358/mongod
varObjectID = functionObjectID(id) { // Duck-typing to support ObjectId from different npm packages if (id instanceofObjectID) return id; if (!(thisinstanceofObjectID)) returnnewObjectID(id);
this._bsontype = 'ObjectID';
// The most common usecase (blank id, new objectId instance) if (id == null || typeof id === 'number') { // Generate a new id this.id = this.generate(id); // If we are caching the hex string if (ObjectID.cacheHexString) this.__id = this.toString('hex'); // Return the object return; }
// Check if the passed in id is valid var valid = ObjectID.isValid(id);
// Throw an error if it's not a valid setup if (!valid && id != null) { thrownewError( 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' ); } elseif (valid && typeof id === 'string' && id.length === 24 && hasBufferType) { returnnewObjectID(utils.toBuffer(id, 'hex')); } elseif (valid && typeof id === 'string' && id.length === 24) { returnObjectID.createFromHexString(id); } elseif (id != null && id.length === 12) { // assume 12 byte string this.id = id; } elseif (id != null && id.toHexString) { // Duck-typing to support ObjectId from different npm packages return id; } else { thrownewError( 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' ); }
if (ObjectID.cacheHexString) this.__id = this.toString('hex'); };