A MongoDB specification based implementation of ObjectID
npm install mongo-objectid

> A MongoDB specification based implementation of ObjectID
Goal is to provide a correct MongoDB ObjectID implementation, in order to ensure impossibility to create similar entries on fast generation (as saw on other open source package)
npm install mongo-objectid
``$xslt`
mkdir myproject
cd myproject
npm init
npm install mongo-objectid
touch index.js
And there just use that snipets to start playing ! :
`js`
const ObjectId = require('mongo-objectid');
const id = new ObjectId();
#### constructor([hexid])
#### toString()
Returns the ID
#### .isValid()
Validate the ID against specification.
#### .setMachineId([machineId])
This will set a new machine id and regenerate new id (careful, timevalue also change with this process).
- machineId : optional - Allow to pass a specific machine id value;
#### .generateNew([time])
Allow to generate a new ID
- time : default : Date.now() - Allow to pass a specific time value
#### .getDate()
Return the Date object corresponding to the time of the ObjectID creation
#### .getTimestamp()`
Return the timestamp in ms corresponding to the time of ObjectID creation
For development purpose, I decided that being able to console view the object without all the nested parent thing was handy a clean.
That's the only reason. But Node V.12 is old enough already, no point sticking to the past.