M220N Migration Issue

For updating the datePipeline and ratingsPipeline I am using this code:

            if (datePipelineResults.Count > 0)
                BulkWriteResult<Movie> bulkWriteDatesResult = null;

                bulkWriteDatesResult = await _moviesCollection.BulkWriteAsync(
                       datePipelineResults.Select(updatedMovie => new ReplaceOneModel<Movie>(
                       new FilterDefinitionBuilder<Movie>().Where(m => m.Id == updatedMovie.Id),

                Console.WriteLine($"{bulkWriteDatesResult.ProcessedRequests.Count} records updated.");

            var ratingPipelineResults = TransformRatingPipeline();
            Console.WriteLine($"I found {ratingPipelineResults.Count} docs where the imdb.rating field is not a number type.");

            if (ratingPipelineResults.Count > 0)
                BulkWriteResult<Movie> bulkWriteRatingsResult = null;
               bulkWriteRatingsResult = await _moviesCollection.BulkWriteAsync(
                    ratingPipelineResults.Select(updatedMovie => new ReplaceOneModel<Movie>(
                    new FilterDefinitionBuilder<Movie>().Where(m => m.Id == updatedMovie.Id),

                Console.WriteLine($"{bulkWriteRatingsResult.ProcessedRequests.Count} records updated.");

I’m able to build and run it without any errors, but then when I go to the Status page in Mflix I get this:

Any idea where I am going wrong?

Hi @Shelby_Carpenter,
Your code looks good to me, but it seems like maybe some of your documents got modified while you were doing the previous exercises, I would recommend a Database refresh by following the steps mentioned in Question 5 of this FAQ post.

Thanks & Regards,
Sourabh Bagrecha,
Curriculum Services Engineer

1 Like

I just tried deleting my sample data and then reloading the sample dataset in Atlas, but am still getting the same error. Any other ideas?

After you modified the code in the Migration project, have you set it as a startup project and run the code?
It should show the following messages in the terminal if executed properly.

I have same mistake. Please help

Hi @Emre_Polat, did you try the steps mentioned in this post:

If you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,

Hello @SourabhBagrecha , thank you for reply. I passed migration test. My fault is that, I did not build migration dll. After run the command which is given belown and the ticket, I succesfully completed the test.
“dotnet build
dotnet bin/Debug/netcoreapp3.1/Migrator.dll”