Data Lost during transfering data from c# program

Hello,

I am trying to transfer data from sql to c#. I am using the offical MongoDB Nu Get package driver … V2.7.0

I insert the object async in a while loop and then check the object.id (see below)

   redakMongo.RedakDocuments.InsertOneAsync(redakDocument);

    if (redakDocument.Id == ObjectId.Empty) continue;

The first question is does the data transfer occur when 1 replica node is down??

Because i don’t know if a node was down during the transfer, the only thing that i have down is to change the primary node.

But the fact is i got an object.id back from the mongo driver and the data was not into the database?

I changed the primary node and start the data transfer again and it was working?

How can i be sure that this erro doesn’t occur again? How can i get a object.id back and the data is not in the database?
Here is the repica setting

BR Christian

Hi Christian - I’m not sure what’s going on here; can you share your connection string? I wonder if it is pointing to a specific server?
(as an aside, the latest driver version is 2.10.2)
Cheers,
Caleb

Hello thanks for answering. …
Today i am trying another test and change during the data Transfer the primary replica to a secondary
with command rs.stepDown().

After ths change the c# transfer programm transfers the data and i get the object.id back but the data was not in the database.

Then when i set the replica set back to standard and it was working …

The connection string looks like the mongo docu:

mongodb:// : @ 1. .local:27017, 2. .local:27017, 3. .local:27017/admin?replicaSet= ******&readPreference=secondaryPreferred.

Is it not possible to change the replica set during the datatransfer?

Thanks in advance