Map Data from MongoDB to Contact Facet

Update the xConnect Endpoint

When a connection is made to xConnect, a model must be specified. The model defines which facets are available. In order to write loyalty program data to xConnect, xDB Data Migration Tool must be configured to use the model you created and deployed to xConnect.

  1. In Content Editor, select your tenant.
  2. Navigate to Endpoints > Providers > xConnect > xConnect Client Endpoint
../../_images/select-xconnect-endpoint.png
  1. In the toolbar, click Show Deployed Models.
../../_images/show-deployed-models-button.png
  1. In the popup window, the custom model you created and deployed to xConnect should appear. Click OK.
../../_images/show-deployed-models-popup.png

Note

If your custom model is not listed, it means the model was not deployed to the xConnect server. Before you continue, you must deploy the model.

  1. In the field Collection Model, select the custom model you created.
../../_images/collection-model-field.png
  1. Save the item.

Update the Pipeline Step that Resolves the Contact Model

  1. In Content Editor, select your tenant.
  2. Navigate to Pipelines > MongoDB Contacts to xConnect Migration Pipelines > Process Single Contact from MongoDB Pipeline > Resolve Contact Model by xDB Tracker Id from xConnect
  3. Locate the field Facets to Read.
  4. Add the following item to the list of selected facets: Collection Models > xDB Data Migration Tool > Custom Migration Model > Facets > Contact > LoyaltyProgram
  5. Save the item.

Specify Data to Read from MongoDB

In order to read data from a contact in MongoDB, xDB Data Migration Tool must be told how to find the data in a MongoDB document. This section describes how to configure the tool so it can read the loyalty program data from a contact stored in MongoDB.

  1. In Content Editor, select your tenant.
  2. Navigate to Data Access > Value Accessor Sets > Providers > MongoDB > MongoDB Contact
  3. Add the following item:
Template MongoDB Document Field Value Accessor
Item name Loyalty Program on MongoDB Contact
  1. Select the new item.
  2. Set the following field values:
Field Value
Field Name LoyaltyProgram
  1. Save the item.
  2. Select your tenant.
  3. Navigate to Data Access > Value Accessor Sets > Providers > MongoDB
  4. Add the following item:
Template MongoDB Document Value Accessor Set
Item name MongoDB Contact Loyalty Program
  1. Select the item MongoDB Contact Loyalty Program.
  2. Add the following item:
Template MongoDB Document Field Value Accessor
Item name Enrollment Date on MongoDB Contact Loyalty Program
  1. Select the new item.
  2. Set the following field values:
Field Value
Field Name EnrollmentDate
BSON Field Value Reader Bson Value Readers > Bson Date Time Value Reader
  1. Save the item.
  2. Select the item MongoDB Contact Loyalty Program.
  3. Add the following item:
Template MongoDB Document Field Value Accessor
Item name Home Store Id on MongoDB Contact Loyalty Program
  1. Select the new item.
  2. Set the following field values:
Field Value
Field Name HomeStoreId
BSON Field Value Reader Bson Value Readers > Bson String Value Reader
  1. Save the item.
  2. Select the item MongoDB Contact Loyalty Program.
  3. Add the following item:
Template MongoDB Document Field Value Accessor
Item name Membership Id on MongoDB Contact Loyalty Program
  1. Select the new item.
  2. Set the following field values:
Field Value
Field Name MembershipId
BSON Field Value Reader Bson Value Readers > Bson Int32 Value Reader
  1. Save the item.

Specify Data to Write to xConnect Contact Facet

In order to write data to a contact in xConnect, xDB Data Migration Tool must be told how to write that data. This section describes how to configure the tool so it can write the loyalty program data to the custom contact facet you created for that data.

  1. In Content Editor, select your tenant.
  2. Navigate to Data Access > Value Accessor Sets > Providers > xConnect
  3. Add the following item:
Template xConnect Entity Facet Value Accessor Set
Item name xConnect Contact Loyalty Program Info Facet
  1. Select the item xConnect Contact Loyalty Program Info Facet.
  2. Add the following item:
Template xConnect Entity Facet Property Value Accessor
Item name Enrollment Date on Loyalty Program Info Facet on xConnect Contact
  1. Select the new item.
  2. Set the following field values:
Field Value
Facet Property Collection Models > xDB Data Migration Tool > Custom Migration Model > Facets > Contact > LoyaltyProgram > EnrollmentDate
  1. Save the item.
  2. Select the item xConnect Contact Loyalty Program Info Facet.
  3. Add the following item:
Template xConnect Entity Facet Property Value Accessor
Item name Home Store Id on Loyalty Program Info Facet on xConnect Contact
  1. Select the new item.
  2. Set the following field values:
Field Value
Facet Property Collection Models > xDB Data Migration Tool > Custom Migration Model > Facets > Contact > LoyaltyProgram > HomeStoreId
  1. Save the item.
  2. Select the item xConnect Contact Loyalty Program Info Facet.
  3. Add the following item:
Template xConnect Entity Facet Property Value Accessor
Item name Membership Id on Loyalty Program Info Facet on xConnect Contact
  1. Select the new item.
  2. Set the following field values:
Field Value
Facet Property Collection Models > xDB Data Migration Tool > Custom Migration Model > Facets > Contact > LoyaltyProgram > MembershipId
  1. Save the item.

Configure Mapping from MongoDB Contact to xConnect Contact Facet

Next you must configure how the data defined in the previous sections is mapped. This means connecting each field from the MongoDB document to a property on the xConnect contact facet.

  1. In Content Editor, select your tenant.
  2. Navigate to Value Mapping Sets > MongoDB to xConnect Contact Mappings
../../_images/mongodb-to-xconnect-contact-mappings.png
  1. Add the following item:
Template Value Mapping Set
Item name MongoDB Loyalty Program to Loyalty Program Info Facet on xConnect Contact
  1. Select the item MongoDB Loyalty Program to Loyalty Program Info Facet on xConnect Contact.
  2. Add the following item:
Template Value Mapping
Item name Enrollment Date
  1. Select the new item.
  2. Set the following field values:
Field Value
Source Accessor Data Access > Value Accessor Sets > Providers > MongoDB > MongoDB Contact Loyalty Program > Enrollment Date on MongoDB Contact Loyalty Program
Target Accessor Data Access > Value Accessor Sets > Providers > xConnect > xConnect Contact Loyalty Program Info Facet > Enrollment Date on Loyalty Program Info Facet on xConnect Contact
  1. Save the item.
  2. Select the item MongoDB Loyalty Program to Loyalty Program Info Facet on xConnect Contact.
  3. Add the following item:
Template Value Mapping
Item name Home Store Id
  1. Select the new item.
  2. Set the following field values:
Field Value
Source Accessor Data Access > Value Accessor Sets > Providers > MongoDB > MongoDB Contact Loyalty Program > Home Store Id on MongoDB Contact Loyalty Program
Target Accessor Data Access > Value Accessor Sets > Providers > xConnect > xConnect Contact Loyalty Program Info Facet > Home Store Id on Loyalty Program Info Facet on xConnect Contact
  1. Save the item.
  2. Select the item MongoDB Loyalty Program to Loyalty Program Info Facet on xConnect Contact.
  3. Add the following item:
Template Value Mapping
Item name Membership Id
  1. Select the new item.
  2. 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 Loyalty Program Info Facet > Membership Id on Loyalty Program Info Facet on xConnect Contact
  1. Save the item.

Specify How xConnect Contact Facet is Populated

Next you must specify how the loyalty program facet on the xConnect contact is populated. This means connecting the facet to the mapping that you configured in the previous section.

  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 Entity Facet Value Accessor Set
Item name Loyalty Program Info Facet on xConnect Contact
  1. Select the new item.
  2. Set the following field values:
Field Value
Facet Definition Collection Models > xDB Data Migration Tool > Custom Migration Model > Facets > Contact > LoyaltyProgram
Mapping Set Value Mapping Sets > MongoDB to xConnect Contact Mappings > MongoDB Loyalty Program to Loyalty Program Info Facet on xConnect Contact
  1. Save the item.

Add Mapping for xConnect Contact Facet to Entity Model for Contact

In order to support submitting batches of changes to xConnect (as opposed to submitting each change individually), xDB Data Migration Tool uses an object called an entity model to store changes to contacts until those changes are ready to be submitted.

You must add a mapping for the new contact facet.

Note

For information on what entity models are and why they are needed, see the developer documentation for the xConnect Provider for Data Exchange Framework.

  1. In Content Editor, select your tenant.
  2. Navigate to Value Mapping Sets > MongoDB to xConnect Contact Mappings > MongoDB Contact to Contact Model
../../_images/mongodb-contact-to-contact-model1.png
  1. Add the following item:
Template Value Mapping
Item name Loyalty Program Info Facet
  1. Select the new item.
../../_images/loyalty-program-facet-on-contact-model.png
  1. 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 Facet on xConnect Contact
  1. Save the item.