How do I migrate to a existing taxonomy reference field? Given a source that has a field with the corresponding ID which outputs the id in the field special like the field nid gives back a node id.

I want to map it to a taxonomy term that is already existing on the new site and not migrated.

This is the process part of my custom yml file:

process:
  nid: nid
  vid: vid
  # there were some more fields here that I left out.
  # hardcode destination node type as publication
  type:
    plugin: default_value
    default_value: publication
  # custom fields
  field_special:
    plugin: static_map
    source: special
    map:
      1: 1
      2: 2
      3: 3


I have a field_special as taxonomy term reference field in the node I want to migrate to.

How can I map the source field to be used in the destination field which is a taxonomy term reference field?

I'm using Drupal 8.1.2 with migrate_plus migrate_tools migrate_drupal enabled.
I've rewritten my yml to use:

field_special:
  plugin: iterator
  source: field_special
  process:
    target_id: tid


And written a preparerow function in my class to output an array as source property:

  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    $nid = $row-&gt;getSourceProperty('nid');

    $result = $this-&gt;getDatabase()-&gt;query(
      'SELECT 
        GROUP_CONCAT(field_special_tid) as tids
      FROM
        {field_data_field_special} fs
      WHERE
        fs.entity_id = :nid
      ',
      array(':nid' =&gt; $nid)
    );
    foreach ($result as $record) {
      if (!is_null($record-&gt;tids)) {
        $row-&gt;setSourceProperty('special', explode(',', $record-&gt;tids));
      }
    }
    return parent::prepareRow($row);
  }


This workaround will do for now, but if you have a better answer please post so I can accept your answer.