【发布时间】:2020-05-12 22:56:47
【问题描述】:
我有一个包含数组类型对象的架构,我想制作一个 api 来更改该数组中的特定字段,可能会更改其名称或删除它
const customerSchema = mongoose.Schema({
_id: mongoose.Schema.Types.ObjectId,
name: {
type: String,
require: true
},
description: String,
fields: {
type: [{
name: String,
environment: String,
challenges: String,
solution: String
}],
default: []
}
});
如何对字段数组的对象进行补丁或删除请求
【问题讨论】:
标签: javascript arrays node.js json patch