Run pipeline batch

Abstract

Guide to running a migration of contact data from MongoDB to Xconnect, and checking the result, in xDB Data Migration Tool.

Now you can run the pipeline batchMongoDB Contacts to xConnect Migration. The new contact facetLoyaltyProgram will be created on xConnect contacts if the required data is available in MongoDB.

After you run the pipeline batch, there are multiple ways you can check to confirm the contact facet was properly created.

You can check the xConnect collection database for records that represent the new facet.

  1. Connect to one of the collection database shards.

  2. Use the following query:

SELECT ContactId, FacetKey, FacetData
  FROM xdb_collection.ContactFacets
  WHERE FacetKey = 'LoyaltyProgram'

You should see a row for each MongoDB contact that has loyalty program data associated with it.

ContactId

FacetKey

FacetData

########-####-####-####-############

LoyaltyProgram

{"@odata.type":"#MigrationTool.Examples.Loyalty...

The following is the complete FacetData value:

{
    "@odata.type":"#MigrationTool.Examples.Loyalty.LoyaltyProgramInfo",
    "MembershipId":100011,
    "EnrollmentDate":"1919-12-12T12:34:56.0000000Z",
    "HomeStoreId":"GARRISON01"
}

You can write an application that uses the xConnect search API to find contacts with the new facet.

var model = new XdbRuntimeModel(CustomMigrationModel.Model);
Uri uri = ... //your xConnect server location goes here
var config = new XConnectClientConfiguration(model, uri);
await config.InitializeAsync();
using (var client = new XConnectClient(config))
{
    var contacts = client.Contacts
        .Where(c => c.GetFacet<LoyaltyProgramInfo>().HomeStoreId != null)
        .GetBatchEnumeratorSync();
    while (contacts.MoveNext())
    {
        foreach (var contact in contacts.Current)
        {
            var expandOptions = new ContactExpandOptions(LoyaltyProgram.DefaultFacetKey);
            var fullContact = await client.GetAsync<Contact>(contact, expandOptions);
            var loyaltyProgramInfoFacet = fullContact.GetFacet<LoyaltyProgramInfo>();
        }
    }
}