Hi!
These are my structs:
type Home struct {
ID primitive.ObjectID `json:"id" bson:"_id"`
Name string `json:"name" bson:"name"`
Location string `json:"location" bson:"location"`
Rooms []Room `json:"rooms" bson:"rooms"`
}
type Room struct {
ID primitive.ObjectID `json:"id" bson:"_id"`
Name string `json:"name" bson:"name"`
Floor int `json:"floor" bson:"floor"`
}
This is my collection:
{
"_id": "611ed1a7e81cf2e4879a73f8",
"name":"blablabla",
"location":"New York",
"rooms":[
{
"_id":"611ed1a7e81cf2e4879a7399",
"name":"test1",
"floor":3
},
{
"_id":"611efbb06986120738b4092f",
"name":"test2",
"floor":5
}
]
}
I want to update the element with _id = 611efbb06986120738b4092f with this:
{
...
"name":"test2_updated",
"floor": 90
}
How can I do this?
Thank you.