Trouble with UUID data when Migrating collection from one Cosmos DB for Mongo DB to another

Justin Wright 0 Reputation points
2024-05-08T15:35:55.4833333+00:00

We are using Azure Data Factory to move a non-prod collection from one Azure Cosmos DB for Mongo DB to another in the same resource group. The are both RU-based resources. I was able to use the "Ingest" template to create a simple pipeline with a single Copy step that was successfully copying documents from the source collection to the desired destination.

Unfortunately, one of the pieces of data is a binary UUID, and the values look different when I view an equivalent document with MongoDB Compass. In the source, I can see the data represented correctly as: UUID('cf3862a0-cfb4-45c8-a6bc-00001b60bda1')

but in the migrated collection it's represented as

Binary.createFromBase64('oGI4z7TPyEWmvAAAG2C9oQ==', 3)

How can I migrate the data and preserve the representation of the binary data UUID data?

Background:

  1. When initially moving data into the source we had C# code using the https://www.mongodb.com/docs/drivers/csharp/v2.19/#mongodb-c--driverthat configured the BSON serializer to achieve the result we want (data in the UUID('cf3862a0-cfb4-45c8-a6bc-00001b60bda1') format)
BsonSerializer.RegisterSerializer(new GuidSerializer(GuidRepresentation.Standard));BsonSerializer.RegisterSerializer(    new ObjectSerializer(BsonSerializer.LookupDiscriminatorConvention(typeof(object)),        GuidRepresentation.Standard));BsonDefaults.GuidRepresentation = GuidRepresentation.Standard;BsonDefaults.GuidRepresentationMode = GuidRepresentationMode.V3;
  1. We have to move a non-prod collection from one Azure Cosmos DB for Mongo DB to another in the same resource group. The are both RU-based resources. I've explored a number of different options to do this including Azure Data Studio (no-go because it doesn't support RU-based databases), mongodbdump/restore and Azure Data Factory. Azure Data Factory looked simple and promising.
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,471 questions
{count} votes