DEV Community

Alessandro
Alessandro

Posted on • Originally published at blog.lamparelli.eu on

Daily : Mon 8 July : Unlimited source of Exercices

Hello everyone, I hope your weekend was refreshing! 🌞

I'm continuing to deepen my understanding of the various concepts I've identified for learning, and I've just finished covering MongoDB management. Now, it's time to consolidate what we've learned! There's nothing better than practice to put our new knowledge into action.

To do this, I asked my trusty ChatGPT to create specific exercises for me, and then I converted them into concrete actions. These are now stored in my development project on GitHub. Here are the exercises I asked ChatGPT to create this morning:

Image description

The content is quite simple: five exercises tailored to the material I've studied. I then compose additional exercises based on what I've learned, incorporating previously covered concepts. Here's an example of a prompt to quickly generate exercises. Let's take MongoDB exercises with the STUDIO 3T tool (a graphical tool for managing MongoDB databases):

Can you create 10 exercises to deepen data manipulation in MongoDB? The exercises should be beginner-level and focus on data manipulation in Studio 3T. Do not provide any code, just the data to be manipulated. The goal is to find the code oneself.

Here's the result:

Of course, here are five beginner-level exercises to help you deepen your data manipulation skills in MongoDB using Studio 3T. Each exercise is designed to help you explore and use different MongoDB features.

Exercise 1: Data Insertion

Context: You work for a library and need to add books to the database.

Data to manipulate:

  1. Add the following books to the books collection:
* Title: "Dune", Author: "Frank Herbert", Year: 1965, Genre: "Science Fiction"

  • Title: "1984", Author: "George Orwell", Year: 1949, Genre: "Dystopia"

  • Title: "Brave New World", Author: "Aldous Huxley", Year: 1932, Genre: "Dystopia"

Enter fullscreen mode Exit fullscreen mode




Exercise 2: Data Update

Context: The genre of some books was incorrectly entered and needs to be corrected.

Data to manipulate:

  1. Change the genre of the book "1984" to "Science Fiction".

  2. Add a "Pages" field with the value 328 to the book "1984".

Exercise 3: Data Deletion

Context: Some books need to be removed from the database as they are no longer available.

Data to manipulate:

  1. Delete the book "Brave New World" from the books collection.

Exercise 4: Data Query

Context: You need to extract specific information from the database for a report.

Data to manipulate:

  1. Retrieve all books of the "Science Fiction" genre.

  2. Retrieve books published before 1950.

Exercise 5: Data Aggregation

Context: You need to produce statistics on the books in the database.

Data to manipulate:

  1. Calculate the total number of books by genre.

  2. Find the oldest book in the collection and display only its title and author.

These exercises will help you practice various basic data operations in MongoDB, such as insertion, updating, deletion, queries, and aggregations. Happy data manipulating!

You can then paste this into an issue that you can track and complete as you finalize each task.

Have a great day and see you soon! 😊

Top comments (0)