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),
                       updatedMovie)));

                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),
                    updatedMovie)));

                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?