Admin Backend: Migration (chapter 4)

I have been at this same one all day and can’t figure out why this isn’t working…

List<ReplaceOneModel<Movie>> models = new List<ReplaceOneModel<Movie>>();
foreach (Movie movie in datePipelineResults)
    ReplaceOneModel<Movie> model = new ReplaceOneModel<Movie>(
        new BsonDocumentFilterDefinition<Movie>(new BsonDocument("_id", movie.Id)), movie);

bulkWriteDatesResult = await _moviesCollection.BulkWriteAsync(models, new BulkWriteOptions(){IsOrdered = false});

Same as above but for the ratings…
It goes through and updates all records but still says that I am missing just one some how?

Starting the data migration.
I found 23530 docs where the lastupdated field is of type 'string'.
23530 records updated.
I found 61 docs where the imdb.rating field is not a number type.
61 records updated.
Checking the data conversions...
[ ] Uh oh. One or both of your pipelines missed 1 documents...
Press <Enter> to close.

Switching the code to get the model to this:

ReplaceOneModel<Movie> model = new ReplaceOneModel<Movie>(Builders<Movie>.Filter.Where(x=>x.Id == movie.Id), movie);

worked for me!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.