如何在数组中的字段中使用猫鼬时区

时间:2019-07-10 12:50:54

标签: arrays mongoose timezone

我成功地使用了猫鼬时区,但是当我用数组中的字段指定猫鼬时区时,服务器未给出响应, 请如何解决?

  const mongoose = require('mongoose');
const timeZone = require('mongoose-timezone');

const Schema = new mongoose.Schema({
date: Date,
subDocument: [{
    subDate: {
        type: Date,
    },
}],
});

// If no path is given, all date fields will be applied
Schema.plugin(timeZone, { paths: ['date', 'subDocument.subDate'] 
  });
mongoose.model('Schema', Schema);  

0 个答案:

没有答案