I know I can't use upsert and the positional operator together, but I am looking for away to append to array if some fields of the object I am inserting do not match some fields in an existing object within the array.
so if I have the existing document below, I would like to check for 'field' field's value and update/replace that subdocument if the fields match, and simply append to the array if they don't.
{
myArray:[
{
field:'xyz'
}
]
}
Is there a good way to do this in node.js? I'm using the native driver.