msgQueryRecordModel.js 762 B

123456789101112131415161718
  1. 'use strict';
  2. module.exports = app => {
  3. const mongoose = app.mongoose;
  4. const Schema = mongoose.Schema;
  5. const conn = app.mongooseDB.get('etlDB');
  6. // 用于提供流量查询结果数据
  7. const MsgQueryRecordSchema = new Schema({
  8. _id: { type: String }, // 日月年+序列号
  9. type: { type: String }, // 流量编码(MSC_016005:流量余量查询、MSC_016015:流量信息查询)
  10. is_success: { type: Number }, // 是否成功(1:成功 0:失败)
  11. create_time: { type: Number }, // 查询流量时间戳(毫秒)
  12. });
  13. MsgQueryRecordSchema.index({ create_time: -1 });
  14. MsgQueryRecordSchema.index({ create_time: -1, is_success: -1 });
  15. return conn.model('MsgQueryRecord', MsgQueryRecordSchema, 'msc_query_record');
  16. };