Hello,
I have really strange situation, which might be normal, but I have to ask it anyway for a hint or such.
I am using the $addToSet to update/upsert documents from a collection. The desired schema of the document is like:
{name:"XXXX",
sources:[
{name:"test1", id:"1"},
{name:"test2", id:"2"}
]
}
However, when the document is update with via update/upsert command, it is not adding/overwriting the matching record in the “sources” set, but simple overwrite the “name” property"
TestCollection.upsert({name:"XXXX"}, {$addToSet:{sources: {name"test1", id:"1"}}}))
and the result is like:
{name:"XXXX",
sources:[
{name:"test1", id:"1"},
{name:"test1", id:"2"}
]
}
in the above case it should have not updated the document, because the element is presented in the set already, but it is actually updating the next element name property. Is this normal?