const FormFieldsSchema = new Schema({
formName: {
type: String,
required: true
},
fields: [
{
fieldLabel: {
type: String,
required: true
},
inputData: [{
type: mongoose.Schema.ObjectId,
ref: "UserData"
}]
}
]
});
Hey everyone, I'm facing an issue with a schema where fields is an array and each item has an _id property. I want to update a specific array item based on the _id value, but so far I've been unsuccessful. I've tried using findByIdAndUpdate
, as well as parent.inputData.id(_id);
, but no success yet. Any suggestions or ideas on how to achieve this?