ADF MongoAtlas Source side error when try to read data using Azure Data Factory

swapnil kamle 26 Reputation points
2023-09-28T10:29:20.8666667+00:00

I am trying to read data from Mongo DB Atlas collection from Azure Data Factory. However, I am getting following error when trying to read data from copy activity:

Failure happened on 'Source' side. 'Type=System.InvalidCastException,Message=Invalid cast from 'System.Int64' to 'System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.,Source=mscorlib,'

I have tested the Linked Service connection its looks fine for me.

Need help to resolve the issue.

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

2 answers

Sort by: Most helpful
  1. Bhargava-MSFT 30,816 Reputation points Microsoft Employee
    2023-09-28T23:09:37.93+00:00

    Hello swapnil kamle

    Welcome to the Microsoft Q&A forum.

    This error generally occurs when the order of each column in the mapping is not the same as the source side.

    To fix this, please change the position of each column in the mapping to match with the source side.

    I hope this helps.

    please let us know if you have any further questions.

    0 comments No comments

  2. Tejas Bhamare 0 Reputation points
    2024-03-01T06:42:47.3333333+00:00

    Hello @Bhargava-MSFT

    My mapping was in order still same error was coming. Then I changed the driver version to v1 in the linked service of mongo DB and it worked for me.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.