Femi A.

asked • 02/29/24

demonstrating advanced query operations

Overview

We will be demonstrating advanced query operations for this assignment. Advanced queries will let you analyze data in a more programmatic fashion at the database layer. Since the key-value structure of an NoSQL database closely resembles the object-oriented data structures of many programming languages, this likeness will enhance the ease and portability of MongoDB queries. The aggregation pipeline facility of MongoDB gives us a set of operators to enable limited set theory operations (grouping, intersections, and so on) for documents within the same collection.

Prompt

After completing the textbook reading and reviewing the module resources, complete the following tasks using the MongoDB shell.

  1. Using the mongoimport tool, create the database “companies” by loading the documents found in the “companies.json” file into the “research” collection. This file is located in the “/usr/local/datasets/” directory in Apporto. Verify your load by issuing the following queries:
  2. db.research.find({"name" : "AdventNet"})
  3. db.research.find({"founded_year" : 1996},{"name" : 1}).limit(10)
  4. Provide screenshots of your statements and the results as evidence.
  5. Perform the following tasks using MongoDB queries:
  6. List only the first 20 names of companies founded after the year 2010, ordered alphabetically.
  7. List only the first 20 names of companies with offices in either California or Texas, ordered by the number of employees and sorted largest to smallest.
  8. Provide screenshots of your statements and the results as evidence.
  9. Design and implement a MongoDB aggregation pipeline to show the total number of offices by state for all companies that have offices in the United States. Be sure that you account for the fact that some companies have offices in several states. Explain your aggregation pipeline.


The assignment must be submitted as a Microsoft Word document (or equivalent) with the appropriate screenshots.


1 Expert Answer

By:

Oliver A. answered • 06/05/24

Tutor
New to Wyzant

Computer science expert with 5+ years of experience

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.