Thanks for reaching out to Microsoft Q&A.
It seems like you're encountering a common issue with the upsert operation in Azure Data Factory (ADF) when working with MongoDB.
Please Check below steps
- Double-check that your mapping configuration is correct. The
_id
field should be mapped properly to ensure that the upsert operation can identify existing records. Your current mapping looks correct, but it's worth verifying. - MongoDB is case-sensitive, so ensure that the field names in your CSV and the MongoDB collection match exactly, including the case.
- Ensure that the data types in your CSV match those expected by MongoDB. For example, if
_id
is expected to be an ObjectId in MongoDB, but it's a string in your CSV, this could cause issues. - Make sure that the upsert operation is correctly configured in your ADF pipeline. The upsert operation should be set to update existing records based on the
_id
field. - Since enabling logging and data consistency verification didn't provide useful insights, you might want to add additional logging or use a different method to verify the data being sent to MongoDB. For example, you could temporarily write the data to a different sink (like a SQL database) to inspect it more easily.
- Inspect the MongoDB logs to see if there are any errors or warnings that might indicate why the upsert operation is not working as expected.
- Try running the pipeline with a minimal dataset (e.g., just one or two rows) to simplify debugging and isolate the issue.
Please refer the links
:Upsert Option in ADF Copy Activity
:Azure Data Factory - Copy Data Task - Upsert is not updating
I hope this information helps. Please do let us know if you have any further queries.
Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.