Movies with "metal" in the full plot

Return all movies with title, languages, fullplot, released, directors, writers, and countries from the 'movies' collection in MongoDB where the word "metal" mentioned in the fullplot.

Structure of 'movies' collection:

    _id: ObjectId("573a1390f29313caabcd42e8"),
plot: 'A group of bandits stage a brazen train hold-up, only to find a determined posse hot on their heels.',
genres: [ 'Short', 'Western' ],
runtime: 11,
cast: [
      'A.C. Abadie',
      "Gilbert M. 'Broncho Billy' Anderson",
      'George Barnes',
      'Justus D. Barnes'
poster: 'https://m.media-amazon.com/images/M/MV5BMTU3NjE5NzYtYTYyNS00MDVmLWIwYjgtMmYwYWIxZDYyNzU2XkEyXkFqcGdeQXVyNzQzNzQxNzI@._V1_SY1000_SX677_AL_.jpg',
title: 'The Great Train Robbery',
fullplot: "Among the earliest existing films in American cinema - notable as the first film that presented a narrative story to tell - it depicts a group of cowboy outlaws who hold up a train and rob the passengers. They are then pursued by a Sheriff's posse. Several scenes have color included - all hand tinted.",
languages: [ 'English' ],
released: ISODate("1903-12-01T00:00:00.000Z"),
directors: [ 'Edwin S. Porter' ],
rated: 'TV-G',
awards: { wins: 1, nominations: 0, text: '1 win.' },
lastupdated: '2015-08-13 00:27:59.177000000',
year: 1903,
imdb: { rating: 7.4, votes: 9847, id: 439 },
countries: [ 'USA' ],
type: 'movie',
tomatoes: {
viewer: { rating: 3.7, numReviews: 2559, meter: 75 },
fresh: 6,
critic: { rating: 7.6, numReviews: 6, meter: 100 },
rotten: 0,
lastUpdated: ISODate("2015-08-08T19:16:10.000Z")


{ fullplot: /metal/i },
{ title: 1, languages: 1, fullplot: 1, released: 1, directors: 1, writers: 1, countries: 1 }


    _id: ObjectId("573a1397f29313caabce6653"),
title: 'Equus',
fullplot: "A psychiatrist, Martin Dysart, investigates the savage blinding of six horses with a metal spike in a stable in Hampshire, England. The atrocity was committed by an unassuming seventeen-year-old stable boy named Alan Strang, the only son of an opinionated but inwardly-timid father and a genteel, religious mother. As Dysart exposes the truths behind the boy's demons, he finds himself face-to-face with his own.",
languages: [ 'English' ],
released: ISODate("1977-10-01T00:00:00.000Z"),
directors: [ 'Sidney Lumet' ],
writers: [ 'Peter Shaffer (play)', 'Peter Shaffer (screenplay)' ],
countries: [ 'UK', 'USA' ]
    _id: ObjectId("573a1397f29313caabce68e6"),
title: 'The Spy Who Loved Me',
fullplot: 'James Bond is back again and his new mission is to find out how a Royal Navy Polaris submarine holding sixteen nuclear warheads simply disappears whilst on patrol. Bond joins Major Anya Amasova and takes on aa web-handed mastermind, known as Karl Stromberg, as well as his henchman Jaws, who has a mouthful of metal teeth. Bond must track down the location of the missing submarine before the warheads are fired.',
languages: [ 'English', 'Italian', 'Arabic' ],
released: ISODate("1977-08-03T00:00:00.000Z"),
directors: [ 'Lewis Gilbert' ],
writers: [ 'Christopher Wood (screenplay)', 'Richard Maibaum (screenplay)' ],
countries: [ 'UK' ]
    _id: ObjectId("573a1397f29313caabce739c"),
title: 'Moonraker',
fullplot: 'James Bond is back for another mission and this time, he is blasting off into space. A spaceship traveling through space is mysteriously hi-jacked and Bond must work quickly to find out who was behind it all. He starts with the rockets creators, Drax Industries and the man behind the organisation, Hugo Drax. On his journey he ends up meeting Dr. Holly Goodhead and encounters the metal-toothed Jaws once again.',
languages: [ 'English', 'Italian', 'Portuguese' ],
released: ISODate("1979-06-29T00:00:00.000Z"),
directors: [ 'Lewis Gilbert' ],
writers: [ 'Christopher Wood (screenplay)' ],
countries: [ 'France', 'UK' ]



The said query in MongoDB returns movies with the 'title', 'languages', 'fullplot', 'released', 'directors', 'writers', and 'countries' fields from the 'movies' collection in MongoDB where the 'fullplot' field contains the word "metal".

In the find() method a regular expression (/metal/) matches document where the 'fullplot' field contains the word "metal".

The 'i' flag makes the regular expression case-insensitive.

In the second parameter the fields with value '1' indicates the inclusion of the 'title', 'languages', 'fullplot', 'released', 'directors', 'writers', and 'countries' fields in the output.

Improve this sample solution and post your code through Disqus.

Previous: Find Movies with "beer" in plot.
Next: Movies with runtime between 60 and 90 minutes.

What is the difficulty level of this exercise?

Follow us on Facebook and Twitter for latest update.