[Solution] Week 2 : CRUD : M101JS: MongoDB for Node.js Developers

[Solution] Week 2 : CRUD : M101JS: MongoDB for Node.js Developers

Homework 2.1 : 

Which of the choices below is the title of a movie from the year 2013 that is rated PG-13 and won no awards? Please query the video.movieDetails collection to find the answer.

NOTE: There is a dump of the video database included in the handouts for the "Creating Documents" lesson. Use that data set to answer this question.

Solution :
    Query : db.movieDetails.find({ "rated": "PG-13", "year": 2013, "awards.wins": 0})
    Answer : A Decade of Decadence,Pt. 2: Legacy of Dreams













Homework 2.2 : 

Using the video.movieDetails collection, which of the queries below would produce output documents that resemble the following. Check all that apply.

NOTE: We are not asking you to consider specifically which documents would be output from the queries below, but rather what fields the output documents would contain.

{ "title" : "P.S. I Love You" }
{ "title" : "Love Actually" }
{ "title" : "Shakespeare in Love" }

Solution :

















Homework 2.3 :


Using the video.movieDetails collection, how many movies list "Sweden" second in the the list of countries.

NOTE: There is a dump of the video database included in the handouts for the "Creating Documents" lesson. Use that data set to answer this question.

Solution :
    Query : db.movieDetails.find({ "countries.1": "Sweden" })
    Answer : 6














Homework 2.4 :


How many documents in our video.movieDetails collection list just the following two genres: "Comedy" and "Crime" with "Comedy" listed first.

NOTE: There is a dump of the video database included in the handouts for the "Creating Documents" lesson. Use that data set to answer this question.

Solution :
    Query : db.movieDetails.find({ "genres": ["Comedy", "Crime"] }).count()
    Answer : 20

















Homework 2.5 :


As a follow up to the previous question, how many documents in the video.movieDetails collection list both "Comedy" and "Crime" as genres regardless of how many other genres are listed?

NOTE: There is a dump of the video database included in the handouts for the "Creating Documents" lesson. Use that data set to answer this question.

Solution :
    Query : db.movieDetails.find({ "genres": {$all: ["Comedy", "Crime"] } })
    Answer : 56

















Homework 2.6 :


Suppose you wish to update the value of the "plot" field for one document in our "movieDetails" collection to correct a typo. Which of the following update operators and modifiers would you need to use to do this?

Solution :

















Enjoy....!!!!

Feel free to comment below your experience with above approach and If you still find any problem  with above steps Let me know I would love to help you to resolve your  problem.

 If you want to take your Technological Knowledge to the Next Level and For More Technological information Stay tuned to Visionfortech


Related Post : 

1) [SOLUTION] WEEK 1 : INTRODUCTION : M101JS: MongoDB for Node.js Developers

2) [SOLUTION] WEEK 2 : CRUD : M101JS: MongoDB for Node.js Developers

3) [SOLUTION] Week 3 :The Node.js Driver : M101JS: MongoDB for Node.js Developers

4) [SOLUTION] WEEK 4 : SCHEMA DESIGN : M101JS: MongoDB for Node.js Developers

5) [SOLUTION] WEEK 5 : INDEXES AND PERFORMANCE : M101JS: MongoDB for Node.js Developers

6) [SOLUTION] WEEK 6 : THE AGGREGATION FRAMEWORK : MongoDB for Node.js Developers

7) [SOLUTION] WEEK 7 :APPLICATION ENGINEERING : MongoDB for Node.js Developers

8) [SOLUTION] FINAL EXAM(PROJECT) :MONGOMART APPLICATION : M101JS: MongoDB for Node.js Developers


Comments

  1. great article, if you are looking for mongodb training please visit mindmajix. They will provide world class training with live projects.

    ReplyDelete

Post a Comment