• Home
  • Blog
  • demonstrating advanced query operations

demonstrating advanced query operations

0 comments

Overview

For this assignment, we will be demonstrating advanced query operations. Advanced queries will allow you to analyze data in a more programmatic fashion at the database layer. Since the key-value structure of a NoSQL database closely resembles the object-oriented data structures of many programming languages, this will enhance the ease and portability of MongoDB queries. The aggregation pipeline facility of MongoDB equips us with 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:
    1. db.research.find({“name” : “AdventNet”})
    2. db.research.find({“founded_year” : 1996},{“name” : 1}).limit(10)

    Provide screenshots of your statements and the results as evidence.

  1. Perform the following tasks using MongoDB queries:
    1. List only the first 20 names of companies founded after the year 2010, ordered alphabetically.
    2. 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.

    Provide screenshots of your statements and the results as evidence.

  1. Design and implement a MongoDB aggregation pipeline to show the total number of employees by state for all companies that have offices in the United States.

    Provide screenshots of your statements and the results as evidence

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}