Incorrect Lecture Handout for Updating Documents: replaceOne()

Hi,

I noticed a typo in lecture handout that made the code not function as intended.

Line 13:
db.movies.replaceOne(filter, doc);

Should be:
db.movieDetails.replaceOne(filter, doc);

2 Likes

Hi David_16758,

Thank you for notifying the issue. I have reported this and will be fixed in some time.

Thanks, Kanika

It bit me … I am learning a lot about debugging JS :wink:

You should fix

let doc = db.movieDetails.findOne(filter);
as well. Thanks!

I think there is a big confusion between the course MondoDB cluster provided with this course and the additional cluster we have created ourselves and uploaded the data from file loadMovieDetailsDataset.js.
The course video database contains the collection “movies”.
The additional cluster contains the database video and the collection “movieDetails”.

The course content on Updating Documents: replaceOne() is mixing both:
let doc = db.movieDetails.findOne(filter);

Unfortunately, the movie titled “House, M.D., Season Four: New Beginning” is NOT in the movieDetails collection, but in the movies collection on the Cluster0 course server.

Unless I have missed a step where that movie was added to the additional cluster we created ourselves in the video database, movieDetails collection in which case I am sorry to bother any body.

But if I am correct, this is very annoying to have to follow a tutorial that is not up-to-date and very confusing as the creator of the tutorial, although highly professional, has not done a correct job.

Guess what? checking the replaceOne.js file, it mentions the db.movies collection indeed!!! Definitely a mixed up between the resources provided and the tutorial video for this step.

Maybe he was trying to force us to get it right and correct the mistake by ourselves? Well done!

Going a bit further in the tutorial, the video says:
doc.genres

“genres” is not accurate and should be:
doc.genre

Last issue I found in this video alone is the statement:
doc.genre(s).push(“TV Series”) error thrown:
push is not a function!

Incredible. Nothing works in that video! Please get it fixed.

So badly done in this video! Shocking. I am glad it is free. There might be more…

I found same problem with push not a function. reloading the shell seems to have fixed it.