【发布时间】:2019-12-05 19:39:33
【问题描述】:
我想根据条件在更新时自动增加一个字段。
我有两个架构:
var History = new Schema({
action : {type: String},
eventType : {type : String}
})
还有:
var Quote = new Schema({
name : {type: String},
email : {type: String},
quoteNumber : {type: Number}
history: [History]
});
quoteNumber 是我希望在记录 histroy 字段更新后立即递增 1 的字段。
【问题讨论】: