I have this document:
{
\"_id\" : ObjectId(\"5b673f525ef92ec6ef16504e\"),
\"events\" : [
{
\"name\" : \"Winner\",
\"
When there are multiple conditions to match inside an array then the .Dot
notation doesn't work with update query.
You need to use $elemMatch to match exact two fields inside an array
db.getCollection('test').updateOne(
{
"_id": ObjectId("5b673f525ef92ec6ef16504e"),
"events": { "$elemMatch": { "name": "Winner", "map": 2 }}
},
{
"$push": { "events.$.something": { "something": "test" }}
}
)