Timestamped Dataset for MongoDB Testing

To enable data extraction from mongoDB, I’ve created a simple tool to load a mongo collection with timestamped data.
Moment.js (momentjs.com) provides the timing tool. Hard-coded are the start and end dates for the dataset. The time increment of the data can also be defined.
Too fine a time interval for a given window of time may result in an unnecessarily large collection size.
The parameters for the min – max random data can also be changed to suit testing needs.
Presently tested with mongoDB 3.4, it should be updated for 3.6. It would be interesting to use Luxon for dates and times in the update.
Also, just for demo, dotenv-expand has been used for application variables.
Just go here for the code:

Leave a Reply

Your email address will not be published. Required fields are marked *