A multipolygon is defined by an array of polygon coordinates, it isn't a collection of polygons so what is returned by getPolygon()
or getPolygons()
should be regarded as clones.
You could either push the linear ring coordinates into the appropriate polygon coordinates and build a new multipolygon
var feature = select.getFeatures().getArray()[0];
var coordinates = feature.getGeometry().getCoordinates();
coordinates[0].push(linearRing.getCoordinates());
feature.setGeometry(new ol.geom.MultiPolygon(coordinates));
or append the linear ring to the polygon then append each polygon clone to a new empty multipolygon
var feature = select.getFeatures().getArray()[0];
var polygons = feature.getGeometry().getPolygons();
polygons[0].append(linearRing);
var multiPolygon = new ol.geom.MultiPolygon([]);
polygons.forEach(function(polygon){
multiPolygon.appendPolygon(polygon);
});
feature.setGeometry(multiPolygon);
The same applies to line strings returned by getLineString()
/getLineStrings()
from a multilinestring.