How to do this in a single mongo query (we should not update the updated field always, only update if other fields got modified)
write_results_obj = db[collection].update_one(query, {update_key: record}, upsert=upsert)
if write_results_obj.modified_count > 0:
db[collection].update_one(query, {updated: datetime.utcnow()})