1
00:00:00,120 --> 00:00:00,490
All right.

2
00:00:00,510 --> 00:00:07,980
And just to give you a better understanding of how and why we need to set up Group Barney, we show

3
00:00:07,980 --> 00:00:10,230
you a small example.

4
00:00:10,740 --> 00:00:13,320
So first, what I want you to do is go back to the post, man.

5
00:00:13,320 --> 00:00:17,190
Now technically, you're going to sit back and relax and just watch me do it.

6
00:00:17,190 --> 00:00:25,110
But if you follow along and go to the post man logging as all three users on my case, I'll start with

7
00:00:25,110 --> 00:00:26,790
John Answers and then Peter.

8
00:00:27,360 --> 00:00:32,340
And then for all of them, I want to create a review for the same product.

9
00:00:32,970 --> 00:00:36,780
And in this case, I'll leave to review the same as far as the rating.

10
00:00:37,560 --> 00:00:42,750
So let's say to your will be with five and then one will be with one or however you want.

11
00:00:43,200 --> 00:00:47,670
But effectively that is that two ratings are the same and then one is different.

12
00:00:48,090 --> 00:00:51,450
So in my case, I'll leave five and I'm going to log in as.

13
00:00:52,530 --> 00:00:53,070
Susan?

14
00:00:54,510 --> 00:00:59,850
And I'll leave the same review five and then I'll logged in as Peter.

15
00:01:01,820 --> 00:01:09,950
Theater, and in this case, I'll leave the review of one of two fives and nine one one one if I take

16
00:01:09,950 --> 00:01:10,970
a look at all the reviews.

17
00:01:11,510 --> 00:01:13,430
I should have three, correct?

18
00:01:13,760 --> 00:01:16,780
Again, like I said, we have cheer with five and none.

19
00:01:17,150 --> 00:01:18,260
One, We're the one.

20
00:01:18,500 --> 00:01:20,480
Then I want to go back to the mango.

21
00:01:21,860 --> 00:01:26,090
In a database refresh, just so I and start from scratch.

22
00:01:26,840 --> 00:01:31,670
And we're looking for our reviews collection, that's step number one.

23
00:01:32,090 --> 00:01:41,340
Then we'll go to aggregation and after that we will set up a grouping we're all group based on rating.

24
00:01:41,810 --> 00:01:48,890
And that's when you actually see that group party in action because at the moment I have been saying

25
00:01:49,280 --> 00:01:51,270
all this time when it comes to group party.

26
00:01:51,290 --> 00:01:55,700
In our example, I could have went, but no, I could have one with product.

27
00:01:56,030 --> 00:01:57,170
It didn't make a difference.

28
00:01:57,200 --> 00:01:59,750
So here I am in the reviews, correct.

29
00:02:00,020 --> 00:02:02,870
And specifically, I'm going to go to aggregation.

30
00:02:03,320 --> 00:02:05,360
I have three documents, correct?

31
00:02:05,750 --> 00:02:09,410
And first, what we want to do first stage do we want to set up is the match.

32
00:02:09,800 --> 00:02:11,830
So for some reason, it just takes ages.

33
00:02:11,850 --> 00:02:15,890
My apologies and I'm going to right away, go to match.

34
00:02:16,340 --> 00:02:17,600
And what am I looking for?

35
00:02:17,900 --> 00:02:26,800
Well, again, I'm looking for all the reviews where product property is equal to the hardcore value,

36
00:02:26,810 --> 00:02:27,170
correct?

37
00:02:28,040 --> 00:02:32,510
And again, all my three reviews point to the same product.

38
00:02:32,980 --> 00:02:34,640
So here I go with objectivity.

39
00:02:35,710 --> 00:02:36,970
And then I want to get it.

40
00:02:37,510 --> 00:02:40,510
So where is the product, where it is?

41
00:02:40,660 --> 00:02:41,860
So let me take it.

42
00:02:42,790 --> 00:02:46,960
And once they match all the products on right hand side.

43
00:02:47,080 --> 00:02:47,360
Yep.

44
00:02:47,530 --> 00:02:49,750
We'll have a sample off three documents.

45
00:02:50,200 --> 00:02:51,880
And now let's add that grouping.

46
00:02:52,510 --> 00:02:55,930
Let's go over it one more time where I'm going to go with add stage.

47
00:02:56,860 --> 00:02:59,410
And then let's set up the group.

48
00:02:59,860 --> 00:03:08,020
And as far as the ad, again, since I got all the reviews that are associated with that product, it

49
00:03:08,020 --> 00:03:10,750
doesn't really make a difference whether I go here with.

50
00:03:11,760 --> 00:03:12,300
No.

51
00:03:14,010 --> 00:03:16,320
No, because I'm not using it.

52
00:03:16,770 --> 00:03:23,970
I'll still get back basically that one response or I'm going to go with product, sir, if you'll set

53
00:03:23,970 --> 00:03:27,930
it up over here as product response is going to be exactly the same.

54
00:03:28,020 --> 00:03:28,500
Why?

55
00:03:28,860 --> 00:03:34,350
Well, because every product is the same in all my documents.

56
00:03:34,980 --> 00:03:37,560
Now where is this going to make sense?

57
00:03:38,100 --> 00:03:40,920
If, for example, you want to count?

58
00:03:42,120 --> 00:03:47,430
How many reviews you have with specific rating for that product?

59
00:03:47,910 --> 00:03:48,970
How we would do that?

60
00:03:48,990 --> 00:03:53,520
Well, in that case, my group already is going to be a rating.

61
00:03:53,910 --> 00:03:59,340
So instead of product, I'll say, yep, group them based on rating.

62
00:03:59,910 --> 00:04:02,340
I'm in each group I want to count.

63
00:04:02,400 --> 00:04:08,400
Notice how right away I get back to documents because remember we were getting back what we were getting

64
00:04:08,400 --> 00:04:09,150
back the right.

65
00:04:09,780 --> 00:04:10,230
Correct.

66
00:04:10,650 --> 00:04:13,560
So in this case, we are getting two documents.

67
00:04:14,050 --> 00:04:19,860
And since we are getting two documents, what that means is that this one is four five.

68
00:04:20,250 --> 00:04:25,620
So this is going to reflect all the reviews where the rating is five and this is for one.

69
00:04:25,980 --> 00:04:29,070
And again, the key difference here is that ratings changing.

70
00:04:29,460 --> 00:04:34,320
I like the product, which is going to be exactly the same since I'm already matched all the ratings

71
00:04:34,680 --> 00:04:36,010
based on that product.

72
00:04:36,030 --> 00:04:37,130
So hopefully that is clear.

73
00:04:37,140 --> 00:04:42,480
And just to make it extremely clear, I'm going to add a some property.

74
00:04:42,750 --> 00:04:47,850
We need to go with curly share and then let's just use some.

75
00:04:47,850 --> 00:04:49,890
And you know what, I'm just going to call this amount.

76
00:04:50,340 --> 00:04:58,800
So now what I want to count is how many reviews I have with that specific rating for that specific product.

77
00:04:59,100 --> 00:04:59,910
And now check it out.

78
00:05:00,600 --> 00:05:04,920
I have two ratings with five just correct and then one with one.

79
00:05:05,610 --> 00:05:06,780
Hopefully this clear.

80
00:05:07,170 --> 00:05:16,080
Hopefully I was able to explain where this idea group comes into play and why in our case, we can either

81
00:05:16,080 --> 00:05:21,810
go with now or we can go with product, and the result is going to be exactly the same.

