Cookies help us deliver our services. By using our services, you agree to our use of cookies. More information

AGGREGATE Movie tutorial

From NoSQLZoo
Jump to: navigation, search

Alien

Use aggregate to show details of the movie "Alien"

db.movies.aggregate([
    {$match:{
        title:"Alien"
    }}
])

db.movie.aggregate([

   {$match:{
       title:"Alien"
   }}

])

John Hurt in Harry Potter

List the Harry Potter movies that feature John Hurt.


db.movies.aggregate([

   {$match:{
       cast:"John Hurt"
   }},
   {$match:{title:{$regex:'Harry Potter'}}},
   {$project:{title:1,_id:0}}

]).pretty()