Giter Site home page Giter Site logo

mongodb_assignment's Introduction

MongoDB_Assignment

01.Create a Database called movies. ... test> use Movies switched to db Movies ...

02.Create a collection called moviedetails. ... Movies> db.createCollection("Moviedetails") { ok: 1 } ...

03.Create above 5 movie documents into a moviedetails collection. ...

Movies> db.moviedetails.insertMany([{ "Movie-Title": "Jurassic Park", "Genre/Type": "Adventure" , "Director": "Steven Spielberg" , "Release Year": "1993" },{ "Movie-Title": "Forrest Gump", "Genre/Type": "Drama" , "Director": "Robert Zemeckies" , "Release Year": "1994" }, { "Movie-Title": "Titanic", "Genre/Type": "Romance", "Director": "James Cameron", "Release Year": "1997" }, { "Movie-Title": "The Dark Knight", "Genre/Type": "Action", "Director": "Christopher Nolan", "Release Year": "2008" },{ "Movie-Title": "Avatar", "Genre/Type": "Science Fiction", "Director": "James Cameron", "Release Year":" 2009" }]) ...

04.List all documents created. ...

Movies> db.moviedetails.find() [ { _id: ObjectId("654c8b00dc08875c2993aa58"), 'Movie-Title': 'Jurassic Park', 'Genre/Type': 'Adventure', Director: 'Steven Spielberg', 'Release Year': 1993 }, { _id: ObjectId("654c8b00dc08875c2993aa59"), 'Movie-Title': 'Forrest Gump', 'Genre/Type': 'Drama', Director: 'Robert Zemeckies', 'Release Year': 1994 }, { _id: ObjectId("654c8b00dc08875c2993aa5a"), 'Movie-Title': 'Titanic', 'Genre/Type': 'Romance', Director: 'James Cameron', 'Release Year': 1997 }, { _id: ObjectId("654c8b00dc08875c2993aa5b"), 'Movie-Title': 'The Dark Knight', 'Genre/Type': 'Action', Director: 'Christopher Nolan', 'Release Year': 2008 }, { _id: ObjectId("654c8b00dc08875c2993aa5c"), 'Movie-Title': 'Avatar', 'Genre/Type': 'Science Fiction', Director: 'James Cameron', 'Release Year': 2009 } ] ...

05.List James Cameron’s movies. ...

Movies> db.moviedetails.find({ "Director": "James Cameron" }) [ { _id: ObjectId("654c8b00dc08875c2993aa5a"), 'Movie-Title': 'Titanic', 'Genre/Type': 'Romance', Director: 'James Cameron', 'Release Year': 1997 }, { _id: ObjectId("654c8b00dc08875c2993aa5c"), 'Movie-Title': 'Avatar', 'Genre/Type': 'Science Fiction', Director: 'James Cameron', 'Release Year': 2009 } ] ...

06.List James Cameron’s movies released in 2009.

...

Movies> db.moviedetails.find({ "Director": "James Cameron","Release Year":2009 }) [ { _id: ObjectId("654c8b00dc08875c2993aa5c"), 'Movie-Title': 'Avatar', 'Genre/Type': 'Science Fiction', Director: 'James Cameron', 'Release Year': 2009 } ] ...

07.Delete the movie which you don’t like. ...

db.Movies.remove({"Movie-Title": "Forrest Gump"}) { acknowledged: true, deletedCount: 0 }

...

08.Add the movie which is your favourite. ...

db.moviedetails.find() [ { _id: ObjectId("654ca1c575a4c6c3f5298594"), 'Movie-Title': 'Jurassic Park', 'Genre/Type': 'Adventure', Director: 'Steven Spielberg', 'Release Year': 1993 }, { _id: ObjectId("654ca1c575a4c6c3f5298595"), 'Movie-Title': 'Forrest Gump', 'Genre/Type': 'Drama', Director: 'Robert Zemeckies', 'Release Year': 1994 }, { _id: ObjectId("654ca1c575a4c6c3f5298596"), 'Movie-Title': 'Titanic', 'Genre/Type': 'Romance', Director: 'James Cameron', 'Release Year': 1997 }, { _id: ObjectId("654ca1c575a4c6c3f5298597"), 'Movie-Title': 'The Dark Knight', 'Genre/Type': 'Action', Director: 'Christopher Nolan', 'Release Year': 2008 }, { _id: ObjectId("654ca1c575a4c6c3f5298598"), 'Movie-Title': 'Avatar', 'Genre/Type': 'Science Fiction', Director: 'James Cameron', 'Release Year': 2009 }, { _id: ObjectId("654ca4dba71a47ec4d1ae7d5"), 'Movie-Title': 'LEO' } ]

...

09.List movie Directed by Christopher Nolan in 1994. ...

db.moviedetails.find({"Movie-Title":"Christopher Nolan","Release Year":1994})

...

10.List out the Director’s Name in your document. ...

db.moviedetails.distinct("Director") [ ... 'Christopher Nolan', 'James Cameron', 'Robert Zemeckies', 'Steven Spielberg' ]

...

mongodb_assignment's People

Contributors

ragukumaran-piratheep avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.