statisticsModel.js 828 B

12345678910111213141516171819
  1. 'use strict';
  2. module.exports = app => {
  3. const mongoose = app.mongoose;
  4. const Schema = mongoose.Schema;
  5. const conn = app.mongooseDB.get('etlLocalDB');
  6. // 统计表 == 按日进行 整体业务的统计 二次清洗表
  7. const StatisticsSchema = new Schema({
  8. create_date: { type: Number }, // 统计的数据是哪一天的
  9. year: { type: Number }, // 年 统计的数据
  10. month: { type: Number }, // 月 统计的数据
  11. day: { type: Number }, // 日 统计的数据
  12. msg: { type: String }, // 统计结果
  13. type: { type: String }, // 任务类型
  14. start_time: { type: Date }, // 开始统计时间
  15. end_time: { type: Date, default: Date.now }, // 结束统计时间
  16. });
  17. StatisticsSchema.index({ create_date: -1 });
  18. return conn.model('Statistics', StatisticsSchema, 'statistics');
  19. };