public FieldUpdate applyTo(Document doc) {
        for (ValueUpdate vupd : valueUpdates) {
            DataType dataType = field.getDataType();
            FieldValue oldValue = doc.getFieldValue(field);
            boolean existed = (oldValue != null);

            if (!existed) {
                oldValue = dataType.createFieldValue();
            }

            FieldValue newValue = vupd.applyTo(oldValue);

            if (newValue == null) {
                if (existed) {
                    doc.removeFieldValue(field);
                }
            } else {
                doc.setFieldValue(field, newValue);
            }
        }
        return this;
    }
Applies this field update.

@param doc the document to apply the update to
@return a reference to itself
document/src/main/java/com/yahoo/document/update/FieldUpdate.java