1 00:00:02,020 --> 00:00:08,620 With size out of the way, let's now have a look at all. For that, I will use the data 2 00:00:08,620 --> 00:00:11,140 I also used in the assignment, 3 00:00:11,390 --> 00:00:14,550 so for me that is stored in the box office database. 4 00:00:14,840 --> 00:00:17,120 So let's use box office 5 00:00:17,120 --> 00:00:21,120 and there if I have a look at all collections, we see there is the movie starts collection. 6 00:00:21,620 --> 00:00:23,650 So I'll work with that movie starts collection, 7 00:00:23,690 --> 00:00:25,110 moviestarts, 8 00:00:25,370 --> 00:00:28,980 let's quickly have a look into it without any filter to see what's in there, 9 00:00:29,000 --> 00:00:36,470 we got three movies and now let's say I want to find movies that have a genre of exactly thriller and 10 00:00:36,470 --> 00:00:43,190 action but I don't care about the order because I've got two movies, this one and this one and they both 11 00:00:43,190 --> 00:00:45,860 only got thriller and action. 12 00:00:45,860 --> 00:00:56,270 The problem I will have is if I use my movie starts here and I find my movies by the genre and I 13 00:00:56,270 --> 00:01:06,310 say it has to be exactly equal to action and thriller, then I will only find one document because only 14 00:01:06,310 --> 00:01:11,920 this document is exactly equal to action being the first element and thriller being the second element 15 00:01:12,010 --> 00:01:13,700 which is what I specified here. 16 00:01:14,020 --> 00:01:20,800 But what if I don't care about the order? Well then, the all operator can help you. For this, 17 00:01:20,800 --> 00:01:28,990 I simply wrap my array in a document where I use $all as operator and that operator receives 18 00:01:29,090 --> 00:01:33,080 my array then and we also need to close that extra curly brace. 19 00:01:33,100 --> 00:01:40,180 What this will do is it will now search genre for these keywords and it will make sure that these items 20 00:01:40,390 --> 00:01:46,060 do have to exist in genre and these items could be numbers, could be embedded documents, could be other arrays 21 00:01:46,060 --> 00:01:47,470 even, doesn't matter 22 00:01:47,470 --> 00:01:51,160 but it ensures that these two elements exist in a genre 23 00:01:51,340 --> 00:01:59,920 but it doesn't care about the order. And therefore now I find both documents even though the order is 24 00:01:59,920 --> 00:02:01,750 different within genre. 25 00:02:02,140 --> 00:02:04,780 So all is really useful if you don't care about the order, 26 00:02:04,810 --> 00:02:08,160 you just want to make sure that all fields are included 27 00:02:08,350 --> 00:02:10,090 but the order does not matter for you.