Merge Records

Is there a way in Java or Node API to merge the record data based upon primary key? I would not like to see whether record exists or now before trying to insert or update the data.