Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielsan80/avanscoperta_timeseries
Avanscoperta Nodejs workshop: timeseries
https://github.com/danielsan80/avanscoperta_timeseries
avanscoperta learn nodejs workshop
Last synced: about 8 hours ago
JSON representation
Avanscoperta Nodejs workshop: timeseries
- Host: GitHub
- URL: https://github.com/danielsan80/avanscoperta_timeseries
- Owner: danielsan80
- License: unlicense
- Created: 2017-02-09T13:10:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-02-10T15:58:15.000Z (over 7 years ago)
- Last Synced: 2024-10-12T04:56:18.759Z (28 days ago)
- Topics: avanscoperta, learn, nodejs, workshop
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Time Series
* Basic Usage
* API```js
var timeseries = require('timeseries')var timeserie = timeseries(mongodbConn, pino);
// 2) put a key & value
timeserie.addPoint(new Date(), 'smog', 45, callback);timeserie.addPoint(new Date(), 'smog', 45, callback);
var stream = timeserie.fetchSerie('smog', {
from: aWeekAgo,
to: new Date(),
});...
```
*
timeseries(mongodbConn, logger)
*timeserie.addPoint(date, type, value, callback)
*timeserie.fetchSerie(type, query = {})
--------------------------------------------------------
### timeseries(mongodbConn, logger)timeseries()
is the main entry point for creating a new timeserie instance.--------------------------------------------------------
### timeserie.addPoint(date, type, value, callback)timeserie.addPoint()
method will add a new point for a specified `type` at the specified `date`. `value` should be a number.```js
timeserie.addPoint(new Date(), 'smog', 42, function (err) {
if (err) throw err
})
```--------------------------------------------------------
### timeserie.fetchSerie(type, query)timeserie.fetchSerie()
method will fetch the point collection for a given `type` matching a given `query`.
This will return a stream of points.```js
var stream = timeserie.fetchSerie('smog', {
from: aWeekAgoDate,
to: new Date()
})
```
#### `Query`* `from` the lower bound date interval.
* `to` the upper bound date interval