weacast/weacast-probe

View on GitHub
src/models/probe-results.model.mongodb.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module.exports = function (app, options) {
  options.Model = app.db.collection('probe-results', options.dbName)
  options.Model.createIndex({ forecastTime: 1 }, { expireAfterSeconds: options.expireAfter || options.ttl || 6 * 3600 })
  options.Model.createIndex({ geometry: '2dsphere' })
  options.Model.createIndex({ probeId: 1 })
  options.Model.createIndex({ forecastTime: 1, probeId: 1 })
}