Retrieving movies directed by William K.L. Dickson
Retrieve all movies from the 'movies' collection that were directed by "William K.L. Dickson" and include complete information for each movie.
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") } .....
Query:
db.movies.find({ directors: "William K.L. Dickson" })
Output:
{ _id: ObjectId("573a1390f29313caabcd4135"), plot: 'Three men hammer on an anvil and pass a bottle of beer around.', genres: [ 'Short' ], runtime: 1, cast: [ 'Charles Kayser', 'John Ott' ], num_mflix_comments: 1, title: 'Blacksmith Scene', fullplot: 'A stationary camera looks at a large anvil with a blacksmith behind it and one on either side. The smith in the middle draws a heated metal rod from the fire, places it on the anvil, and all three begin a rhythmic hammering. After several blows, the metal goes back in the fire. One smith pulls out a bottle of beer, and they each take a swig. Then, out comes the glowing metal and the hammering resumes.', countries: [ 'USA' ], released: ISODate("1893-05-09T00:00:00.000Z"), directors: [ 'William K.L. Dickson' ], rated: 'UNRATED', awards: { wins: 1, nominations: 0, text: '1 win.' }, lastupdated: '2015-08-26 00:03:50.133000000', year: 1893, imdb: { rating: 6.2, votes: 1189, id: 5 }, type: 'movie', tomatoes: { viewer: { rating: 3, numReviews: 184, meter: 32 }, lastUpdated: ISODate("2015-06-28T18:34:09.000Z") } }, { _id: ObjectId("573a139ef29313caabcfe4f1"), plot: 'The sound has been found in the form of an old Edisonian recording cylinder. The cylinder was repaired, then Walter Murch ACE MPSE synced the film to the correct music in (I believe) 2002. Total running time is approximately 17 seconds.', genres: [ 'Short' ], runtime: 1, title: 'Dickson Experimental Sound Film', countries: [ 'USA' ], fullplot: 'The earliest extant sound film. William K.L. Dickson stands in the background next to a huge sound pickup horn connected to a Thomas Edison phonograph recorder. As he plays a violin, two men dance in the foreground. This film was made to demonstrate a new Thomas Edison machine, the Kinetophone. These machines were Kinetoscope peepshow viewers mated with Thomas Edison wax cylinder phonographs. But the Kinetophone never caught on and this film was never released. The film still exists, but the phonograph soundtrack has been lost.', languages: [ 'English' ], cast: [ 'William K.L. Dickson' ], directors: [ 'William K.L. Dickson' ], rated: 'NOT RATED', awards: { wins: 1, nominations: 0, text: '1 win.' }, lastupdated: '2015-06-16 00:30:38.357000000', year: 1894, imdb: { rating: 6.8, votes: 1101, id: 177707 }, type: 'movie', tomatoes: { viewer: { rating: 3.8, numReviews: 1794, meter: 84 }, dvd: ISODate("2001-05-22T00:00:00.000Z"), production: 'Sony Pictures Home Entertainment', lastUpdated: ISODate("2015-08-23T18:16:01.000Z") } }, { _id: ObjectId("573a13a3f29313caabd0d5a4"), plot: 'An athlete swings Indian clubs.', genres: [ 'Documentary', 'Short' ], runtime: 1, title: 'Newark Athlete', num_mflix_comments: 3, countries: [ 'USA' ], fullplot: 'A young man stands before the camera holding a club in each hand, horizontal to the ground. He raises the heads of the two clubs in unison, by rotating the clubs without lifting his arms. The film then shows the same footage over again, at different speeds.', languages: [ 'English' ], directors: [ 'William K.L. Dickson' ], rated: 'NOT RATED', awards: { wins: 1, nominations: 0, text: '1 win.' }, lastupdated: '2015-08-03 00:57:26.680000000', year: 1891, imdb: { rating: 4.9, votes: 827, id: 241763 }, type: 'movie', tomatoes: { lastUpdated: ISODate("2012-09-30T00:00:00.000Z") } }
Explanation:
The said query in MongoDBretrieves all movies with full information from the 'movies' collection that were directed by "William K.L. Dickson".
The find() method finds documents where the value of the 'directors' field contains "William K.L. Dickson".
Improve this sample solution and post your code through Disqus.
Previous: Find movies with "Short" genre.
Next: Movies released in the USA.
What is the difficulty level of this exercise?
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/mongodb-exercises/mongodb-movies-collection-exercise-4.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics