26medias / timeseries-analysis

NPM Package - Timeseries analysis, noise removal, stats, ...
238 stars 48 forks source link

From mongoose, get date from nested element #7

Closed amlwwalker closed 4 years ago

amlwwalker commented 7 years ago

Is there a way to specify the date field in mongo/oose object, for instance I have a mongo object like:

{
    "_id" : ObjectId("5988797d39009be743441bfa"),
    "id" : 14227183,
    "timestamp" : {
        "time" : ISODate("2017-08-07T14:29:47.140Z")
    },
    "price" : 0.00586018,
}

from the example, I tried the following (see timestamp.time). Is something like that possible

var t     = new timeseries.main(timeseries.adapter.fromDB(data, {
    date:   'timestamp.time',
    value:  'price'
}));