---
title: "Map data from MongoDB to contact identifier"
slug: "map-data-from-mongodb-to-contact-identifier"
abstract: "How to map MongoDB data to an xConnect contact identifier in xDB Data Migration Tool."
---
# Map data from MongoDB to contact identifier

<details>
<summary><h2>Specify value for xConnect contact identifier source</h2></summary>

Since xDB Migration Tool is pre-configured to create contact identifiers, components needed to read the *Identifier* and *Identifier type* values already exist in the tenant. You only need to create the component needed to read the *Source* value.

1. In Content Editor, select your tenant.
2. Navigate to *Data Access / Value Readers / Providers / xConnect*

    ![The <tenant> / Data Access / Value Readers / Providers / xConnect node in the Content tree.](https://doc.sitecore.com/api/markdown-image/xp/en/developers/dmt/50/xdb-data-migration-tool/images/xconnect-value-readers-root.png)

3. Add the following item:

    |     |     |
    | --- | --- |
    | Template | *Constant Value Reader* |
    | Item name | *Constant Value - Contact Identifier Source for Loyalty Program* |

4. Select the new item.
5. Set the following field values:

    | Field | Value |
    | --- | --- |
    | Value | `Loyalty.Program` |
    | Value Type | *String* |

6. Save the item.
7. Select your tenant.
8. Navigate to *Data Access / Value Accessors / Providers / xConnect*

    ![The <tenant> / Data Access / Value Accessors / Providers / xConnect node in the Content tree.](https://doc.sitecore.com/api/markdown-image/xp/en/developers/dmt/50/xdb-data-migration-tool/images/value-accessor-for-loyalty-program-source.png)

9. Add the following item:

    |     |     |
    | --- | --- |
    | Template | *Value Accessor* |
    | Item name | *Source for Contact Identifier for Loyalty Program* |

10. Select the new item.
11. Set the following field values:

    | Field | Value |
    | --- | --- |
    | Value Reader | *Value Readers > Providers > xConnect > Constant Value - Contact Identifier Source for Loyalty Program* |

12. Save the item.

</details>

<details>
<summary><h2>Add mapping for xConnect contact identifier onstructor</h2></summary>

xConnect Contact Identifiers are instantiated using a constructor that requires three parameters. You must map values to the constructor parameters in order to create a new contact identifier.

1. In Content Editor, select your tenant.
2. Navigate to *Value Mapping Sets / MongoDB to xConnect Contact Mappings*
3. Add the following item:

    |     |     |
    | --- | --- |
    | Template | *Value Mapping Set* |
    | Item name | *MongoDB Loyalty Program to xConnect Contact Identifier Constructor* |

4. Select the item *MongoDB Loyalty Program to xConnect Contact Identifier Constructor*.
5. Add the following item:

    |     |     |
    | --- | --- |
    | Template | *Value Mapping* |
    | Item name | *Source* |

6. Select the new item.
7. Set the following field values:

    | Field | Value |
    | --- | --- |
    | Source Accessor | *Data Access > Value Accessors > Providers > xConnect > Source for Contact Identifier for Loyalty Program* |
    | Target Accessor | *Data Access > Value Accessor Sets > Providers > xConnect > xConnect Contact Identifier > Source on xConnect Contact Identifier Constructor* |

8. Save the item.
9. Select the item *MongoDB Loyalty Program to xConnect Contact Identifier Constructor*.
10. Add the following item:

    |     |     |
    | --- | --- |
    | Template | *Value Mapping* |
    | Item name | *Identifier* |

11. Select the new item.
12. Set the following field values:

    | Field | Value |
    | --- | --- |
    | Source Accessor | *Data Access > Value Accessor Sets > Providers > MongoDB > MongoDB Contact Loyalty Program > Membership Id on MongoDB Contact Loyalty Program* |
    | Target Accessor | *Data Access > Value Accessor Sets > Providers > xConnect > xConnect Contact Identifier > Identifier on xConnect Contact Identifier Constructor* |

13. Save the item.
14. Select the item *MongoDB Loyalty Program to xConnect Contact Identifier Constructor*.
15. Add the following item:

    |     |     |
    | --- | --- |
    | Template | *Value Mapping* |
    | Item name | *Identifier Level* |

16. Select the new item.
17. Set the following field values:

    | Field | Value |
    | --- | --- |
    | Source Accessor | *Data Access > Value Accessors > Providers > xConnect > Known Contact Identification Level for xConnect Accessor* |
    | Target Accessor | *Data Access > Value Accessor Sets > Providers > xConnect > xConnect Contact Identifier > Identifier Type on xConnect Identifier Constructor* |

18. Save the item.

</details>

<details>
<summary><h2>Add value accessor for custom identifier</h2></summary>

1. In Content Editor, select your tenant.
2. Navigate to *Data Access / Value Accessor Sets / Providers / xConnect / xConnect Contact*
3. Add the following item:

    |     |     |
    | --- | --- |
    | Template | *xConnect Contact Identifier Value Accessor* |
    | Item name | *Loyalty Program Identifier on xConnect Contact* |

4. Set the following field values:

    | Field | Value |
    | --- | --- |
    | Constructor Mapping Set | *Value Mapping Sets > MongoDB to xConnect Contact Mappings > MongoDB Loyalty Program to xConnect Contact Identifier Constructor* |

5. Save the item.

</details>

<details>
<summary><h2>Add Mapping for xConnect contact identifier to entity model for contact</h2></summary>

1. In Content Editor, select your tenant.
2. Navigate to *Value Mapping Sets / MongoDB to xConnect Contact Mappings / MongoDB Contact to Contact Model*

    ![The Value Mapping Sets / MongoDB to xConnect Contact Mappings / MongoDB Contact to Contact Model node in the Content Tree.](https://doc.sitecore.com/api/markdown-image/xp/en/developers/dmt/50/xdb-data-migration-tool/images/mongodb-contact-to-contact-model.png)

3. Add the following item:

    |     |     |
    | --- | --- |
    | Template | *Value Mapping* |
    | Item name | *Loyalty Program Identifier* |

4. Select the new item.
5. Set the following field values:

    | Field | Value |
    | --- | --- |
    | Source Accessor | *Data Access > Value Accessor Sets > Providers > MongoDB > MongoDB Contact > Loyalty Program on MongoDB Contact* |
    | Target Accessor | *Data Access > Value Accessor Sets > Providers > xConnect > xConnect Contact > Loyalty Program Identifier on xConnect Contact* |

6. Save the item.

</details>