Lets say I have this Object:
{town_id: 13, houses_data: [
{house_id: 5, price: 32, description: "thats a house"},
{house_id: 2, price: 12, description: "thats a house"}
]
}
And I want to update the desription of house with id 5 to "sold":
{town_id: 13, houses_data: [
{house_id: 5, price: 32, description: "sold"},
{house_id: 2, price: 12, description: "thats a house"}
]
}
What I tried:
town1 = town.findOne({town_id: 13});
Get the houses_data:
twon1.houses_data
And tried to update only the house_data where id = 5
twon1.houses_data.find({house_id: 5}).update(description: "sold");
But I get this error message:
[object Object],[object Object] has no method 'find'
What do I wrong? Thanks