1 00:00:02,040 --> 00:00:08,110 Now that we had a brief look at how we can query embedded documents and arrays, 2 00:00:08,200 --> 00:00:11,380 let me come back to my comparison selectors here. 3 00:00:11,380 --> 00:00:16,680 We had a look at most of them but we did not look at $in or $nin, 4 00:00:16,690 --> 00:00:20,170 now what do these two operators do? Now 5 00:00:20,190 --> 00:00:20,910 for that, 6 00:00:21,190 --> 00:00:28,780 let's come back to let's say the runtime. I'll reach out to my movies again and pretty print the results 7 00:00:29,050 --> 00:00:31,640 and the filter I'll specify here 8 00:00:31,660 --> 00:00:33,270 will check the runtime field 9 00:00:33,420 --> 00:00:42,370 and I want to make sure that the runtime is either 30 or 42. Now we know that in our dataset, I could 10 00:00:42,370 --> 00:00:49,660 achieve this with lower than or equal to 42 because we just happen to have data with 30, 42 and 60 minutes 11 00:00:49,660 --> 00:00:50,190 in there 12 00:00:50,230 --> 00:00:55,810 so this will give us all the items that have a runtime lower than or equal 42 which is all the items 13 00:00:55,810 --> 00:00:57,500 with 30 or 42 14 00:00:57,790 --> 00:01:02,650 but of course, that's not the case for every dataset and we might not even know that our data looks like 15 00:01:02,650 --> 00:01:03,260 that. 16 00:01:03,280 --> 00:01:08,010 So if we know there are two discrete values we want to check for, 17 00:01:08,110 --> 00:01:15,230 we can use $in operator. In takes an array and now this does not mean it looks for this array 18 00:01:15,500 --> 00:01:21,810 but in this array, we specify all the values that will be accepted as values for this key, 19 00:01:21,860 --> 00:01:24,530 so in our case 30 and 42. 20 00:01:24,530 --> 00:01:30,560 So it will find us all documents that have a runtime of 30 or 42 but not of 60 21 00:01:30,590 --> 00:01:34,220 or if we had 15 minutes, this would also be excluded. 22 00:01:34,250 --> 00:01:40,840 So if I now hit enter, we get back a bunch of results and you should only find runtime equal to 30 in there 23 00:01:41,180 --> 00:01:49,900 or a runtime equal to 42, like for this document. Now nin is just the opposite, 24 00:01:50,060 --> 00:01:57,000 we could say we want to find everything where the value is not in this range or this is not a range 25 00:01:57,050 --> 00:01:59,330 but in this set of values, 26 00:01:59,360 --> 00:02:08,710 so now we would find all values, all entries where the runtime is not equal to 30 or 42. 27 00:02:08,770 --> 00:02:14,830 So if I now hit enter in our dataset, this will now only include items with a runtime of 60 but again 28 00:02:14,830 --> 00:02:21,220 if you had more values there, like 15 minutes, 20 minutes, these would now also be included in our result 29 00:02:21,310 --> 00:02:22,480 set here. 30 00:02:22,510 --> 00:02:28,080 So that is in and not in, these two missing comparison operators. 31 00:02:28,100 --> 00:02:30,830 And with that we had a look at all comparison operators, 32 00:02:30,850 --> 00:02:34,600 so let's now move on to logical operators in the next module.