Insert-TS-data is a small piece of code to create a basic realtime data stream into a mongodb collection.
Tested against mongodb 3.6 and node driver 3.1.1 and therefore uses latest connection URI methods.
Code also illustrates a basic setup of the forever.js task runner with nodemon.js.
Get the code here:
https://github.com/ravenOSS/Insert-TS-data
Month: August 2018
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:
https://github.com/ravenOSS/insertPlotDataSet