Chapter 1: Labs



MongoDB University

M001: MongoDb-Basics Quiz/Labs Solution

Chapter 1 :  Introduction

LABS

Lab 1.2: Determine the Value Type, Part 1


   Problem:
   If you have not yet downloaded Compass, please follow these instructions. Then 
   answer the question below.
  1. Please download Compass from the MongoDB Download Center.
  2. Install Compass on your computer from the download.
  3. Launch Compass.
   When Compass opens you will see a page titled "Connect to Host".
  1. Use the following information to complete this form, but do not click "Connect" yet. Hostname is cluster0-shard-00-00-jxeqq.mongodb.net. Username is m001-student. Password is m001-mongodb-basics.
  2. Click "Add to Favorites" so that you can easily connect to our class MongoDB deployment after closing and restarting Compass at some point in the future.
  3. Now, click "Connect" and load the databases in the M001 class MongoDB deployment.

Question:
 Which of the following field names appear in documents in the movies collection of the  video database. Check all that apply.
  • _id
  • cast
  • comments
  • director
  • genre
  • length
  • plot
  • stars
Answer:

  1. Download the Compass tool at the address given in the title, MongoDB Compass
  2. Install MongoDB Compass tool (graphic interface, tool operation)
  3. Start the MongoDB Compass tool and configure it as shown. Log in to the remote database service using the given account password.
  4. Once the connection is established, you will see the following page

    5. Enter video library's movie collection. And Observe the field names that appear:
     _id,cast,director,genre,plot











Lab 1.2: Determine the Value Type, Part 1


Problem:
What is the value type of the ts field for documents in the 100YWeatherSmall.data collection?
Choose the best answer:
  • array 
  •  coordinates 
  •  date 
  •  document 
  •  double 
  •  int32 
  •  mixed string and int32 
  •  mixed string and double 
  •  string

Answer:

1. In the 100YWeatherSmall.data collection , choose the table view in the Document Section.



2. Notice that the data type of ts is Date.





Lab 1.3: Determine the Value Type, Part 2

Problem:
What is the value type of the ts field for documents in the 100YWeatherSmall.data collection?
Choose the best answer:
  •  array 
  •  coordinates 
  •  date 
  •  document 
  •  double 
  •  int32 
  •  mixed string and int32 
  •  mixed string and double 
  •  string

Answer:

1. The airTemperature field of the data collection of the 100YWeatherSmall library is an             embedded  document.



2. Note that the terms 'object' and 'document' are interchangeably used.



Lab 1.4: Determine the Value Type, Part 3

Problem:
What is the value type of the year field for documents in the video.movies collection?
Choose the best answer:
  •  array 
  •  coordinates 
  •  date 
  •  document 
  •  double 
  •  int32 
  •  mixed string and int32 
  •  mixed string and double 
  •  string

Answer:

1. Similar to lab 1.2

.


2. Notice that the data type of year is Int32.




Lab 1.5: Scavenger Hunt, Part 1

Problem:
How many movies in the video collection were directed by Patty Jenkins. Stated more precisely, how many documents in the video.movies collection have a value of “Patty Jenkins” for the director field?


Choose the best answer:
  • 13 
  •  47 
  •  98 
  •  143
Answer:
1. Enter the video.movies collection and enter the following query command in the fiter field
    {"director":"Patty Jenkins"}


2. Notice that there are results that fulfill the filter query.


Lab 1.6: Scavenger Hunt, Part 2

Problem:
How many documents in the citibike.trips collection have a tripduration that is greater than 
or equal to 60 and less than 65?


Choose the best answer:
  • 94 
  •  216 
  •  355 
  •  754
Answer:
1. Enter the citibike.trips collection and enter the following query command in the fiter field


    {"tripduration":{"$gte":60,"$lt":65}}


2. Notice that there are 754 results that fulfill the filter query.



Lab 1.6: Scavenger Hunt, Part 3

Problem:
Based on our shipwrecks dataset, how many shipwrecks lay off the coast of Cancun, Mexico? Choose the answer that best describes the number of shipwrecks you are able to find using Compass.


Choose the best answer:
  •  0-10 
  •  25-50 
  •  51-100 
  •  101-200 
  •  201 or more


Answer:

1. Enter the ships.shipwrecks collection and switch to Schema Mode.






2. Observe the coordinates field, which depicts the number of shipwrecks in map mode.
     Drag around to find Cancun, Mexico. 


     Press shift + Drag around to build a query.
4. Observe that number of shipwrecks in Cancun, Mexico lies between 0-10. 




Comments

  1. Hello Sir, Do you habe for Lab 2.1 and so on ?

    thanks

    ReplyDelete
  2. Link updated here please check : http://bit.ly/2m1xdQk

    ReplyDelete
  3. Nice tutorials..thanks for sharing such a wonderful information..keep update with your blogs.
    Full Stack online Training
    Full Stack Training
    Full Stack Developer Online Training

    ReplyDelete
  4. Very impressive article! The blog is highly informative and has answered all my questions.
    To introduce about our company and the activities, B2B contactlist
    is a database provider that helps you to boost your sales & grow your business through well-build Laboratory director mailing lists.

    ReplyDelete
  5. Great learning experience with proficient trainers in Informatica. Flexible timings with hands on experience with real time scenarios.
    MongoDB Training in Bangalore

    ReplyDelete

Post a Comment

Popular posts from this blog

Chapter 1: Quizzes