I'm trying to do upsert and I get duplicate error on Unique field. Shouldn't upsert take care of whether to update an existing record or to add a new record?
caused by: System.DmlException: Upsert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: Unique_ID__c duplicates value on record
List<MyObject__c> obj = new List<MyObject__c>(); //populate list with data upsert(obj);