Find Movies with "beer" in plot

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

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")


plot: { $regex: /beer/i } 
title: 1, 
languages: 1, 
plot: 1, 
released: 1, 
directors: 1, 
writers: 1, 
countries: 1 


    _id: ObjectId("573a13cdf29313caabd85413"),
plot: "A film that depicts the mentality of the inhabitants of a small village on the Baltic coast. Three guys are trying to fulfill their life's by drinking beer, killing time and picking up ...",
title: 'Kolka Cool',
languages: [ 'Latvian' ],
released: ISODate("2011-12-16T00:00:00.000Z"),
directors: [ 'Juris Poskus' ],
writers: [
      'Juris Poskus (screenplay)',
      'Juris Poskus (story)',
      'AleksandrRodionov (additional material)'
countries: [ 'Latvia' ]
    _id: ObjectId("573a13d2f29313caabd920ae"),
    plot: "A bold, amateur kidnapping goes wildly awry in this fictionalized account of beer magnate Freddy Heineken's 1983 abduction, which would go on to become one of The Netherlands' most infamous crimes.",
title: 'The Heineken Kidnapping',
languages: [ 'Dutch', 'English', 'French' ],
released: ISODate("2011-10-27T00:00:00.000Z"),
directors: [ 'Maarten Treurniet' ],
writers: [ 'Maarten Treurniet', 'Kees van Beijnum' ],
countries: [ 'Netherlands' ]
    _id: ObjectId("573a13d9f29313caabdaa68e"),
plot: 'The Z-Fighters must contend with Lord Beerus, the God of Destruction, but only a God can fight a God, and none of them are Gods. However with the creation of the Super Saiyan God, will the Z-Fighters be able to defeat Lord Beerus?',
title: 'Dragon Ball Z: Battle of Gods',
languages: [ 'Japanese' ],
released: ISODate("2014-08-05T00:00:00.000Z"),
directors: [ 'Masahiro Hosoda' ],
writers: [
      'Akira Toriyama (manga)',
      'Akira Toriyama (original author)',
      'Jared Hedges (english adaptation)',
      'Yèsuke Watanabe (screenplay)'
countries: [ 'Japan' ]



The said query in MongoDB returns movies with the title, languages, fullplot, released, directors, writers, and countries fields from the 'movies' collection in MongoDB that mention the word "beer" in their plot field.

In the find() method the $regex operator performs a case-insensitive regular expression search for the word "beer" in the plot field.

The parameter in the projection stage includes title, languages, plot, released, directors, writers, and countries field in the output.

Improve this sample solution and post your code through Disqus.

Previous: Find Movies with "Fire" in fullplot.
Next: Movies with "metal" in the full plot.

What is the difficulty level of this exercise?

Follow us on Facebook and Twitter for latest update.