i have a serious problem in updating my data . i have no idea how i can update a specific field in an object of an array in my document .
here is my Schema model :
var shiftSchema = new Schema({
Phone: String,
final: Boolean,
statusSH: String,
order: {
startTime: String,
finishTime: String,
income: String,
orders: [{
stat: String,
orderId: String,
customerPhone: String,
orderQuantity: String,
orderCost: String,
orderCondition: String,
orderTag: String
}]
}
});
when i use "find" it gives me the document and not just the object.
now how can i edit "stat" by finding "orderId" ?
Note that i do not have the index of the object that i want to update and i can just use "find"or "findOne".
i search all over the web and i couldn't find a good guide and example .
sorry for my bad english.
All tips will be appreciated. Thank You.