I want to update an array value but I am not sure about the proper method to do it, so for I tried the following method but didn’t work for me.
My model, The children field in my model
childrens: {
type: Array,
default: ''
}
My query,
Employeehierarchy.update({ _id: employeeparent._id} ,{ $set: {"$push": { "childrens": employee._id }} }) .exec(function (err, managerparent) {});
Can anyone please provide me with help. Thanks.