...

/

Exercise: Create a New Movie

Exercise: Create a New Movie

Practice creating a unique document in MongoDB using the Go API.

We'll cover the following...

Problem statement

The duplication of documents in a collection is an interesting phenomenon. Sometimes we allow duplication, for example, a genre_id may repeat for multiple movies. Sometimes we don’t allow duplication, for example, the movie_id of two movies should not be the same. We need to maintain the uniqueness of movie IDs in our collection. This exercise gives us the opportunity to stop duplication when creating a new document.

Task

For this exercise, you need to create a new movie by checking its existence in the database based on the movie_id.

There are two movies in the database:

Access this course and 1400+ top-rated courses and projects.