How to populate the id field in Mongo DB from Azure Data Factory

Evan Wellens 66 Reputation points
2021-08-17T22:17:14.927+00:00

So we have an azure data factory pipeline that copies json data ( see below ) into a mongo db collection. What I'm seeing is the ADF is creating id's even though our json has the field.
ie ( yes these aren't the same document just showing an example )
Json
{
"id": "c9f90e4d-e996-5c64-cbc5-9d69fc86a251",
"SourceId": 8483083285,
"GenreId": 3230,
"Genre": "General Entertainment",
"Delta": "INS",
"Country": "BR",
"Created": "2021-08-17T20:06:15.3954669Z",
"LastModified": "2021-08-17T20:06:15.3954669Z"
}

Mongo Document
_id:611c1aa3e50fdf139c830079
id:"04187122-d66a-46ae-b46c-2e5599cd375f"
SourceId:69021597
GenreId:3230
Genre:"General Entertainment"
Delta:"INS"
Country:"BR"
Created:"2021-08-17T20:18:20.1528428Z"
LastModified:"2021-08-17T20:18:20.1528428Z"

Is there a way to specify the id during import ?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,196 questions
0 comments No comments
{count} votes

Accepted answer
  1. ShaikMaheer-MSFT 38,406 Reputation points Microsoft Employee
    2021-08-18T10:43:29.137+00:00

    Hello @Evan Wellens ,

    Thank you for posting query in Microsoft Q&A Platform.

    Data Factory automatically generates an _id for a document if an _id isn't specified either in the original document or by column mapping.

    So, If you don't want ADF to generate _id then you should consider column mapping or having _id column in source.

    Please Note, to achieve schema-agnostic copy, skip the "structure" (also called schema) section in dataset and schema mapping in copy activity.

    Click here to know more about Mongo DB connector in Azure data factory.
    Click here to know about Mongo DB as Sink dataset properties in Azure data factory.

    Hope this helps. Please let us know if any further queries. Thank you.

    ------------------------

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful