====== HW 3 – Document data stores. MongoDB ====== **(5 points)** - Design the data structures based on the analytical tasks (see HW1) that are intended to be solved with MongoDB. * The structures must be designed so that the target queries are feasible. * Avoid overly nested documents. * Denormalize only when it benefits performance; do not create overly deep nesting that complicates queries. - Insert the data into MongoDB using the CSV/JSON generated for the project (see HW0). Use the Base dataset as defined in HW0. * Load only what is needed for tasks/comparisons. Do not import unnecessary data. - Implement and run the queries (see HW1). Create supporting indexes for every analytical query. * Use the Aggregation Pipeline; do not use `$where`, server-side JavaScript, or `mapReduce`. * Apply appropriate time filters, groupings, and KPIs as required by your HW1 tasks (do not hardcode specific fields like “country/action” if your domain differs). * For each query, include `db.collection.explain("executionStats").aggregate(...)` (or the relevant command) and show a compact excerpt of the plan in the report. - Prepare a report and include: * the text from HW0 and HW1 (edited if necessary); * the collections creation and document-insertion commands, with explanations of why this structure was chosen; * the data import code; * the queries used to solve the analytical tasks. For each task, provide: * the task number (as in the previous work); * the verbal description of the task; * the query code with explanations; * a screenshot (or excerpt) of the query result and the `explain("executionStats")` output. Note. If some analytical tasks turn out to be infeasible or meaningless, you may replace them with others and propagate the corresponding changes to the earlier work (HW0/HW1). Submit to the BRUTE system: * **HW3.docx** file. Submit to the NoSQL server (nosql.felk.cvut.cz) the hw3.js file with MongoDB commands with short comments. * Submission: * **''hw3.js''**: JavaScript script with MongoDB database commands * Execution: * Execute the following shell command to evaluate the whole MongoDB script mongosh --port 42222 -u login -p password database hw3.js * ''$login'' is your username, e.g. ''f25_login'' * ''$database'' - database to connect to (same as login) * ''$password'' is your password (Use the same password you received for your account at the beginning of the semester) * ''$file'' is a file with MongoDB queries to be executed, i.e. ''hw3.js'' * Double dashes before port * Tools: * [[http://www.mongodb.com/|MongoDB]] 7.0.14 (installed on the NoSQL server) * References: * [[https://docs.mongodb.com]] * Server: **nosql.felk.cvut.cz** * Do not forget to execute the homework submission script! * Deadline: **Sunday 23. 11. 2025** until 23:59