Barcelona suffered their first defeat of the season as they went down 3-2 to Real Sociedad in the Primera Liga.