WEBVTT

1
00:00:03.055 --> 00:00:04.665
<00:00:03.055>Okay, <00:00:03.335>let's <00:00:03.615>get <00:00:03.895>right <00:00:04.175>into <00:00:04.455>it.

2
00:00:04.765 --> 00:00:09.385
<00:00:04.765>To <00:00:04.892>today's <00:00:05.019>topic <00:00:05.146>is <00:00:05.274>how <00:00:05.401>do <00:00:05.528>we <00:00:05.655>do <00:00:05.783>data <00:00:05.910>modeling <00:00:06.037>for <00:00:06.164>NoSQL

3
00:00:09.485 --> 00:00:13.505
<00:00:09.485>or <00:00:09.718>more <00:00:09.951>specifically <00:00:10.184>for <00:00:10.418>MongoDB, <00:00:10.651>the <00:00:10.885>company

4
00:00:13.645 --> 00:00:16.305
<00:00:13.645>and <00:00:13.820>the <00:00:13.995>database <00:00:14.170>that <00:00:14.344>I <00:00:14.520>am <00:00:14.695>currently <00:00:14.870>working <00:00:15.045>for.

5
00:00:16.845 --> 00:00:18.385
<00:00:16.845>And <00:00:17.122>this <00:00:17.399>is <00:00:17.676>an <00:00:17.953>introductory <00:00:18.231>talk,

6
00:00:18.445 --> 00:00:21.505
<00:00:18.445>so <00:00:18.585>don't <00:00:18.725>worry <00:00:18.865>if <00:00:19.005>you <00:00:19.145>don't <00:00:19.285>know <00:00:19.425>anything <00:00:19.565>about <00:00:19.705>NoSQL, <00:00:19.845>SQL

7
00:00:21.565 --> 00:00:24.465
<00:00:21.565>or <00:00:21.845>SQL <00:00:22.125>as <00:00:22.405>people <00:00:22.685>call <00:00:22.965>it.

8
00:00:25.085 --> 00:00:28.905
<00:00:25.085>And <00:00:25.212>just <00:00:25.339>let's <00:00:25.466>get, <00:00:25.594>let's <00:00:25.721>get <00:00:25.848>right <00:00:25.975>into <00:00:26.103>it. <00:00:26.230>You'll <00:00:26.357>be <00:00:26.485>fine.

9
00:00:31.785 --> 00:00:34.035
<00:00:31.785>Yeah. <00:00:32.018>Let's <00:00:32.251>start <00:00:32.485>with <00:00:32.718>a <00:00:32.951>simple <00:00:33.185>definition.

10
00:00:34.105 --> 00:00:36.755
<00:00:34.105>Data <00:00:34.279>modeling <00:00:34.455>is <00:00:34.629>the <00:00:34.805>process <00:00:34.980>of <00:00:35.154>figuring <00:00:35.330>out <00:00:35.504>how

11
00:00:36.755 --> 00:00:40.355
<00:00:36.755>to <00:00:36.955>represent <00:00:37.155>and <00:00:37.355>store <00:00:37.555>data <00:00:37.755>in <00:00:37.955>your <00:00:38.155>system,

12
00:00:40.615 --> 00:00:41.675
<00:00:40.615>in <00:00:41.092>your <00:00:41.568>application.

13
00:00:42.575 --> 00:00:45.395
<00:00:42.575>So <00:00:42.730>we <00:00:42.886>are <00:00:43.041>all <00:00:43.197>developers, <00:00:43.352>we're <00:00:43.508>all <00:00:43.663>working <00:00:43.819>with <00:00:43.975>data,

14
00:00:45.695 --> 00:00:48.235
<00:00:45.695>and <00:00:45.870>at <00:00:46.045>some <00:00:46.220>point <00:00:46.395>we <00:00:46.570>actually <00:00:46.745>need <00:00:46.920>a <00:00:47.095>database

15
00:00:48.255 --> 00:00:50.075
<00:00:48.255>or <00:00:48.488>some <00:00:48.721>mechanism <00:00:48.955>of <00:00:49.188>storing <00:00:49.421>this <00:00:49.655>data.

16
00:00:50.575 --> 00:00:52.635
<00:00:50.575>So <00:00:50.750>this <00:00:50.925>is <00:00:51.100>what <00:00:51.275>we're <00:00:51.450>gonna <00:00:51.625>be <00:00:51.800>covering <00:00:51.975>today.

17
00:00:52.975 --> 00:00:57.795
<00:00:52.975>How <00:00:53.102>do <00:00:53.229>we <00:00:53.356>properly <00:00:53.484>store <00:00:53.611>data <00:00:53.738>in <00:00:53.865>a <00:00:53.993>way <00:00:54.120>that <00:00:54.247>is <00:00:54.375>optimized?

18
00:00:58.255 --> 00:01:00.915
<00:00:58.255>But <00:00:58.410>you <00:00:58.566>might <00:00:58.721>be <00:00:58.877>wondering <00:00:59.032>why <00:00:59.188>you <00:00:59.343>should <00:00:59.499>care <00:00:59.655>about

19
00:01:00.915 --> 00:01:02.515
<00:01:00.915>that <00:01:01.195>if <00:01:01.475>you're <00:01:01.754>a <00:01:02.035>frontend <00:01:02.315>developer

20
00:01:02.735 --> 00:01:04.995
<00:01:02.735>or <00:01:02.935>if <00:01:03.135>you <00:01:03.335>are <00:01:03.535>new <00:01:03.735>to <00:01:03.935>this <00:01:04.135>topic.

21
00:01:05.895 --> 00:01:08.475
<00:01:05.895>And <00:01:06.128>the <00:01:06.361>answer <00:01:06.595>is <00:01:06.828>that <00:01:07.061>getting <00:01:07.295>started

22
00:01:08.475 --> 00:01:10.875
<00:01:08.475>with <00:01:08.675>a <00:01:08.875>good <00:01:09.074>data <00:01:09.274>model <00:01:09.475>from <00:01:09.675>the <00:01:09.875>beginning

23
00:01:11.655 --> 00:01:14.715
<00:01:11.655>or <00:01:11.830>accomplishing <00:01:12.005>a <00:01:12.180>good <00:01:12.355>data <00:01:12.530>model <00:01:12.705>while <00:01:12.880>you're <00:01:13.055>developing

24
00:01:14.715 --> 00:01:17.115
<00:01:14.715>your <00:01:14.915>application <00:01:15.115>will <00:01:15.315>lead <00:01:15.515>you <00:01:15.715>to <00:01:15.915>better <00:01:16.115>performance

25
00:01:17.935 --> 00:01:20.995
<00:01:17.935>and <00:01:18.168>it'll <00:01:18.401>also <00:01:18.635>improve <00:01:18.868>your <00:01:19.101>developer <00:01:19.335>productivity.

26
00:01:21.375 --> 00:01:24.635
<00:01:21.375>And <00:01:21.515>in <00:01:21.655>the <00:01:21.795>end, <00:01:21.935>it's <00:01:22.075>gonna <00:01:22.215>also <00:01:22.355>result <00:01:22.495>in <00:01:22.635>lower <00:01:22.775>overall

27
00:01:24.645 --> 00:01:27.035
<00:01:24.645>costs <00:01:24.994>for <00:01:25.345>your <00:01:25.695>development <00:01:26.045>solution.

28
00:01:27.775 --> 00:01:29.995
<00:01:27.775>So <00:01:27.915>this <00:01:28.055>is <00:01:28.195>why <00:01:28.335>you <00:01:28.475>need <00:01:28.615>to <00:01:28.755>care <00:01:28.895>about <00:01:29.035>data <00:01:29.175>modeling.

29
00:01:30.295 --> 00:01:31.635
<00:01:30.295>And <00:01:30.596>if <00:01:30.898>I've <00:01:31.199>convinced <00:01:31.501>you

30
00:01:31.895 --> 00:01:33.555
<00:01:31.895>and <00:01:32.095>you're <00:01:32.295>not <00:01:32.494>switching <00:01:32.695>to <00:01:32.895>the <00:01:33.095>other <00:01:33.295>tool

31
00:01:33.555 --> 00:01:36.155
<00:01:33.555>that <00:01:33.835>is <00:01:34.115>currently <00:01:34.395>running, <00:01:34.675>let's <00:01:34.955>see

32
00:01:36.155 --> 00:01:37.715
<00:01:36.155>what <00:01:36.435>we're <00:01:36.715>gonna <00:01:36.995>be <00:01:37.275>talking <00:01:37.555>about.

33
00:01:38.805 --> 00:01:42.955
<00:01:38.805>First. <00:01:38.945>We'll <00:01:39.085>see <00:01:39.225>what <00:01:39.365>is <00:01:39.505>this <00:01:39.645>term, <00:01:39.785>NoSQL <00:01:39.925>or <00:01:40.065>no <00:01:40.205>SQL,

34
00:01:43.055 --> 00:01:44.675
<00:01:43.055>and <00:01:43.405>where <00:01:43.755>does <00:01:44.105>Mongo <00:01:44.455>DB

35
00:01:44.895 --> 00:01:47.755
<00:01:44.895>and <00:01:45.128>document <00:01:45.361>databases <00:01:45.595>fit <00:01:45.828>within <00:01:46.061>this <00:01:46.295>term?

36
00:01:49.045 --> 00:01:50.255
<00:01:49.045>Then <00:01:49.317>we're <00:01:49.589>gonna <00:01:49.861>talk <00:01:50.134>about

37
00:01:50.515 --> 00:01:53.895
<00:01:50.515>how <00:01:50.715>we <00:01:50.915>can <00:01:51.115>model <00:01:51.315>relationships <00:01:51.515>in <00:01:51.715>our <00:01:51.915>applications

38
00:01:54.275 --> 00:01:56.895
<00:01:54.275>and <00:01:54.450>how <00:01:54.625>we <00:01:54.800>can <00:01:54.975>represent <00:01:55.150>them <00:01:55.325>in <00:01:55.500>the <00:01:55.675>database.

39
00:01:58.405 --> 00:02:00.555
<00:01:58.405>We're <00:01:58.638>gonna <00:01:58.871>talk <00:01:59.105>about <00:01:59.338>two <00:01:59.571>main <00:01:59.805>strategies

40
00:02:00.615 --> 00:02:03.235
<00:02:00.615>for <00:02:00.895>modeling <00:02:01.175>relationships, <00:02:01.455>which <00:02:01.735>are <00:02:02.015>embedding

41
00:02:03.335 --> 00:02:05.755
<00:02:03.335>and <00:02:03.801>referencing <00:02:04.268>where <00:02:04.735>we'll

42
00:02:06.295 --> 00:02:08.475
<00:02:06.295>see <00:02:06.470>which <00:02:06.645>one <00:02:06.820>we <00:02:06.995>should <00:02:07.170>use <00:02:07.345>in <00:02:07.520>which <00:02:07.695>case,

43
00:02:08.615 --> 00:02:10.795
<00:02:08.615>and <00:02:08.770>we'll <00:02:08.926>also <00:02:09.081>go <00:02:09.237>through <00:02:09.392>some <00:02:09.548>questions <00:02:09.703>that <00:02:09.859>we <00:02:10.015>need

44
00:02:10.795 --> 00:02:13.435
<00:02:10.794>to <00:02:10.994>ask <00:02:11.195>ourselves <00:02:11.394>when <00:02:11.595>we <00:02:11.795>are <00:02:11.994>getting <00:02:12.195>started

45
00:02:14.065 --> 00:02:17.195
<00:02:14.065>with <00:02:14.265>data <00:02:14.465>modeling <00:02:14.665>and <00:02:14.865>with <00:02:15.065>developing <00:02:15.265>our <00:02:15.465>application.

46
00:02:18.295 --> 00:02:20.955
<00:02:18.295>And <00:02:18.575>finally, <00:02:18.855>we'll <00:02:19.135>talk <00:02:19.415>about <00:02:19.695>duplication

47
00:02:20.975 --> 00:02:24.195
<00:02:20.975>and <00:02:21.208>stillness, <00:02:21.441>which <00:02:21.674>are <00:02:21.908>inevitable <00:02:22.141>in <00:02:22.375>the

48
00:02:25.005 --> 00:02:26.235
<00:02:25.005>NoSQL <00:02:26.112>world.

49
00:02:27.015 --> 00:02:30.675
<00:02:27.015>So <00:02:27.190>we'll <00:02:27.364>see <00:02:27.540>why <00:02:27.714>duplication <00:02:27.890>happens, <00:02:28.065>what <00:02:28.239>it <00:02:28.415>means

50
00:02:31.015 --> 00:02:34.315
<00:02:31.015>to <00:02:31.170>our <00:02:31.326>data <00:02:31.481>model <00:02:31.637>when, <00:02:31.792>how <00:02:31.948>we <00:02:32.103>should <00:02:32.259>handle <00:02:32.415>it.

51
00:02:36.705 --> 00:02:40.325
<00:02:36.704>But <00:02:36.938>first, <00:02:37.171>let's <00:02:37.404>talk <00:02:37.638>about <00:02:37.871>SQL <00:02:38.105>databases.

52
00:02:41.165 --> 00:02:43.385
<00:02:41.165>So <00:02:41.445>in <00:02:41.725>SQL <00:02:42.005>or <00:02:42.285>traditional <00:02:42.565>databases,

53
00:02:43.405 --> 00:02:46.225
<00:02:43.405>you <00:02:43.605>usually <00:02:43.805>split <00:02:44.005>your <00:02:44.205>data <00:02:44.405>between <00:02:44.605>different <00:02:44.805>tables.

54
00:02:46.325 --> 00:02:48.585
<00:02:46.325>So <00:02:46.500>you <00:02:46.674>may <00:02:46.850>have <00:02:47.024>a <00:02:47.200>table <00:02:47.375>for <00:02:47.549>products <00:02:47.725>table

55
00:02:48.695 --> 00:02:50.585
<00:02:48.695>that <00:02:49.045>has <00:02:49.394>information <00:02:49.745>about <00:02:50.095>merchants

56
00:02:50.965 --> 00:02:52.745
<00:02:50.965>and <00:02:51.315>also <00:02:51.665>table <00:02:52.015>for <00:02:52.365>reviews.

57
00:02:53.855 --> 00:02:55.585
<00:02:53.855>Then <00:02:54.321>you <00:02:54.788>combine <00:02:55.255>this,

58
00:02:56.255 --> 00:02:58.705
<00:02:56.255>this <00:02:56.535>information <00:02:56.815>from <00:02:57.095>these <00:02:57.375>different <00:02:57.655>tables

59
00:02:58.815 --> 00:03:00.045
<00:02:58.815>into <00:02:59.184>a <00:02:59.553>single <00:02:59.922>result.

60
00:03:00.305 --> 00:03:04.405
<00:03:00.305>And <00:03:00.505>you <00:03:00.705>usually <00:03:00.905>use <00:03:01.105>a <00:03:01.305>language <00:03:01.505>called <00:03:01.705>SQL

61
00:03:04.545 --> 00:03:07.525
<00:03:04.545>or <00:03:04.825>SQL <00:03:05.105>to <00:03:05.385>perform <00:03:05.665>these <00:03:05.945>queries.

62
00:03:08.475 --> 00:03:12.205
<00:03:08.475>This <00:03:08.650>is <00:03:08.825>why <00:03:09.000>they're <00:03:09.174>called <00:03:09.350>SQL <00:03:09.525>or <00:03:09.700>SQL <00:03:09.875>databases.

63
00:03:14.595 --> 00:03:17.005
<00:03:14.595>Then <00:03:14.795>at <00:03:14.995>some <00:03:15.195>point <00:03:15.395>in <00:03:15.595>time, <00:03:15.795>maybe <00:03:15.995>20

64
00:03:17.225 --> 00:03:21.885
<00:03:17.225>or <00:03:17.380>10 <00:03:17.536>years <00:03:17.691>ago, <00:03:17.847>there <00:03:18.002>comes <00:03:18.158>the <00:03:18.313>new, <00:03:18.469>um, <00:03:18.625>type

65
00:03:21.885 --> 00:03:24.445
<00:03:21.885>of <00:03:22.165>databases, <00:03:22.445>which <00:03:22.725>are <00:03:23.005>called <00:03:23.285>NoSQL.

66
00:03:25.345 --> 00:03:27.165
<00:03:25.345>But <00:03:25.625>this <00:03:25.905>one <00:03:26.185>is <00:03:26.465>super <00:03:26.745>confusing

67
00:03:27.165 --> 00:03:29.925
<00:03:27.165>because <00:03:27.304>it's, <00:03:27.445>let's <00:03:27.584>face <00:03:27.725>it, <00:03:27.864>it's <00:03:28.005>kind <00:03:28.144>of <00:03:28.285>a <00:03:28.424>marketing <00:03:28.565>term

68
00:03:30.265 --> 00:03:34.045
<00:03:30.265>and <00:03:30.404>it's <00:03:30.545>meant <00:03:30.684>to <00:03:30.825>me <00:03:30.964>not <00:03:31.105>only <00:03:31.244>sql, <00:03:31.385>so <00:03:31.524>not <00:03:31.665>only,

69
00:03:34.185 --> 00:03:36.765
<00:03:34.185>but <00:03:34.385>it's, <00:03:34.585>it's <00:03:34.785>still <00:03:34.985>written <00:03:35.185>down <00:03:35.385>as <00:03:35.585>NoSQL.

70
00:03:36.945 --> 00:03:39.125
<00:03:36.945>So <00:03:37.144>it <00:03:37.345>can <00:03:37.545>be <00:03:37.745>super <00:03:37.945>confusing <00:03:38.144>to <00:03:38.345>people.

71
00:03:40.305 --> 00:03:43.165
<00:03:40.305>That's <00:03:40.505>why <00:03:40.705>people <00:03:40.905>started <00:03:41.105>using <00:03:41.305>the <00:03:41.505>different <00:03:41.705>term,

72
00:03:43.165 --> 00:03:47.165
<00:03:43.165>which <00:03:43.340>is <00:03:43.515>non <00:03:43.690>relational <00:03:43.864>databases <00:03:44.040>when <00:03:44.215>talking <00:03:44.390>about <00:03:44.565>Mongo

73
00:03:47.225 --> 00:03:50.685
<00:03:47.225>GB <00:03:47.424>or <00:03:47.625>other, <00:03:47.825>uh, <00:03:48.025>of <00:03:48.225>these <00:03:48.424>modern <00:03:48.625>databases.

74
00:03:51.025 --> 00:03:53.085
<00:03:51.025>But <00:03:51.180>as <00:03:51.336>we're <00:03:51.491>gonna <00:03:51.647>see <00:03:51.802>in <00:03:51.958>the <00:03:52.113>next <00:03:52.269>three <00:03:52.425>minutes,

75
00:03:53.105 --> 00:03:56.885
<00:03:53.105>you <00:03:53.338>can <00:03:53.571>very <00:03:53.804>successfully <00:03:54.038>model <00:03:54.271>relationships, <00:03:54.505>uh,

76
00:03:56.885 --> 00:03:58.045
<00:03:56.885>between <00:03:57.407>different <00:03:57.929>pieces

77
00:03:58.105 --> 00:04:00.965
<00:03:58.105>of <00:03:58.304>data <00:03:58.505>in <00:03:58.704>your <00:03:58.905>application <00:03:59.105>when <00:03:59.304>storing <00:03:59.505>them

78
00:04:01.185 --> 00:04:02.285
<00:04:01.185>in <00:04:01.680>this <00:04:02.175>databases.

79
00:04:02.385 --> 00:04:04.165
<00:04:02.385>So <00:04:02.584>this <00:04:02.785>is <00:04:02.984>not <00:04:03.185>the <00:04:03.385>best <00:04:03.584>term <00:04:03.785>ever.

80
00:04:05.265 --> 00:04:08.725
<00:04:05.265>And <00:04:05.404>another <00:04:05.545>term <00:04:05.684>that <00:04:05.825>I'm <00:04:05.964>gonna <00:04:06.105>stick <00:04:06.244>to <00:04:06.385>is <00:04:06.524>non <00:04:06.665>tabular,

81
00:04:08.835 --> 00:04:10.685
<00:04:08.835>because <00:04:09.068>this <00:04:09.301>means <00:04:09.535>that <00:04:09.768>the <00:04:10.001>data <00:04:10.235>model

82
00:04:10.685 --> 00:04:15.085
<00:04:10.685>that <00:04:10.840>is <00:04:10.996>used <00:04:11.151>in <00:04:11.307>these <00:04:11.462>modern <00:04:11.618>databases <00:04:11.773>is <00:04:11.929>different <00:04:12.085>from

83
00:04:15.175 --> 00:04:19.765
<00:04:15.175>rigid <00:04:15.375>stables <00:04:15.575>that <00:04:15.775>are <00:04:15.975>used <00:04:16.175>in <00:04:16.375>traditional <00:04:16.575>databases.

84
00:04:20.705 --> 00:04:22.285
<00:04:20.704>So <00:04:20.984>what <00:04:21.265>is <00:04:21.544>this <00:04:21.825>data <00:04:22.104>model?

85
00:04:23.535 --> 00:04:26.265
<00:04:23.535>Well, <00:04:23.690>this <00:04:23.846>really <00:04:24.001>depends <00:04:24.157>on <00:04:24.312>the <00:04:24.468>database <00:04:24.623>that <00:04:24.779>you <00:04:24.935>choose.

86
00:04:27.325 --> 00:04:29.825
<00:04:27.325>We <00:04:27.500>have <00:04:27.675>a <00:04:27.849>whole <00:04:28.025>bunch <00:04:28.200>of <00:04:28.375>non <00:04:28.550>tabular <00:04:28.724>databases

87
00:04:29.845 --> 00:04:34.065
<00:04:29.845>and <00:04:30.020>we <00:04:30.195>can <00:04:30.370>group <00:04:30.545>them <00:04:30.720>into <00:04:30.895>four <00:04:31.070>different <00:04:31.245>categories.

88
00:04:34.805 --> 00:04:36.385
<00:04:34.805>We <00:04:35.271>have <00:04:35.738>document <00:04:36.205>databases

89
00:04:36.385 --> 00:04:38.665
<00:04:36.385>where <00:04:36.664>you <00:04:36.945>store <00:04:37.224>data <00:04:37.505>in <00:04:37.784>documents.

90
00:04:39.205 --> 00:04:40.825
<00:04:39.205>We <00:04:39.555>have <00:04:39.905>key <00:04:40.255>value <00:04:40.604>databases

91
00:04:40.825 --> 00:04:43.065
<00:04:40.825>where <00:04:41.025>you <00:04:41.224>store <00:04:41.425>data <00:04:41.625>in <00:04:41.825>key <00:04:42.025>value <00:04:42.224>pairs.

92
00:04:43.525 --> 00:04:47.025
<00:04:43.525>We <00:04:43.700>also <00:04:43.875>have <00:04:44.049>white <00:04:44.224>column <00:04:44.400>stores <00:04:44.575>and <00:04:44.750>graph <00:04:44.924>databases.

93
00:04:47.645 --> 00:04:51.385
<00:04:47.645>And <00:04:47.820>today <00:04:47.995>we're <00:04:48.169>gonna <00:04:48.344>be <00:04:48.520>focusing <00:04:48.695>on <00:04:48.870>document <00:04:49.044>databases

94
00:04:51.525 --> 00:04:54.345
<00:04:51.525>and <00:04:51.758>more <00:04:51.991>specifically <00:04:52.224>on <00:04:52.458>MongoDB, <00:04:52.691>which <00:04:52.924>is

95
00:04:55.045 --> 00:04:56.905
<00:04:55.045>the <00:04:55.325>leading <00:04:55.605>document <00:04:55.885>database <00:04:56.165>out <00:04:56.445>there.

96
00:04:58.315 --> 00:05:02.455
<00:04:58.315>So <00:04:58.470>we <00:04:58.626>narrow <00:04:58.781>down <00:04:58.937>this <00:04:59.092>NoSQL <00:04:59.248>term <00:04:59.403>to <00:04:59.559>document <00:04:59.715>databases

97
00:05:02.795 --> 00:05:05.055
<00:05:02.795>and <00:05:03.145>more <00:05:03.495>specifically <00:05:03.845>to <00:05:04.195>MongoDB.

98
00:05:06.715 --> 00:05:09.255
<00:05:06.715>And <00:05:06.994>let's <00:05:07.275>start <00:05:07.554>from <00:05:07.835>this <00:05:08.114>definition

99
00:05:09.315 --> 00:05:10.975
<00:05:09.315>and <00:05:09.781>talk <00:05:10.248>through, <00:05:10.715>uh,

100
00:05:11.285 --> 00:05:14.375
<00:05:11.285>what <00:05:11.460>we <00:05:11.635>mean <00:05:11.810>when <00:05:11.985>we <00:05:12.160>say <00:05:12.335>a <00:05:12.510>document <00:05:12.685>database

101
00:05:14.555 --> 00:05:17.215
<00:05:14.555>and <00:05:14.755>how <00:05:14.955>the <00:05:15.155>data <00:05:15.355>model, <00:05:15.555>uh, <00:05:15.755>looks <00:05:15.955>like.

102
00:05:19.035 --> 00:05:21.055
<00:05:19.035>So <00:05:19.235>naturally, <00:05:19.435>the <00:05:19.635>first <00:05:19.835>round <00:05:20.035>that <00:05:20.235>we <00:05:20.435>have

103
00:05:21.055 --> 00:05:23.175
<00:05:21.055>to <00:05:21.405>define <00:05:21.755>is <00:05:22.105>a <00:05:22.455>document.

104
00:05:24.315 --> 00:05:28.335
<00:05:24.315>And <00:05:24.548>a <00:05:24.781>document <00:05:25.015>is <00:05:25.248>really, <00:05:25.481>uh, <00:05:25.715>something

105
00:05:28.335 --> 00:05:30.495
<00:05:28.335>that <00:05:28.614>looks <00:05:28.895>quite <00:05:29.174>a <00:05:29.455>bit <00:05:29.734>like

106
00:05:31.195 --> 00:05:34.335
<00:05:31.195>an <00:05:31.428>object <00:05:31.661>in <00:05:31.895>your <00:05:32.128>favorite <00:05:32.361>programming <00:05:32.594>language.

107
00:05:34.715 --> 00:05:38.095
<00:05:34.715>Um, <00:05:34.842>in <00:05:34.969>this <00:05:35.096>case <00:05:35.224>it <00:05:35.351>looks <00:05:35.478>a <00:05:35.605>little <00:05:35.733>bit <00:05:35.860>like <00:05:35.987>a <00:05:36.115>JavaScript,

108
00:05:38.315 --> 00:05:41.695
<00:05:38.315>um, <00:05:38.470>object <00:05:38.626>or <00:05:38.781>quite <00:05:38.937>a <00:05:39.092>lot <00:05:39.248>like <00:05:39.403>a <00:05:39.559>JavaScript <00:05:39.715>object

109
00:05:41.695 --> 00:05:46.215
<00:05:41.695>because, <00:05:41.928>uh, <00:05:42.161>it's <00:05:42.395>actually <00:05:42.628>a <00:05:42.861>b <00:05:43.094>notation

110
00:05:46.515 --> 00:05:48.695
<00:05:46.515>and <00:05:46.794>B <00:05:47.075>stands <00:05:47.354>for <00:05:47.635>binary, <00:05:47.914>Jason

111
00:05:48.835 --> 00:05:53.135
<00:05:48.835>and <00:05:49.010>Jason <00:05:49.185>is, <00:05:49.359>um, <00:05:49.534>stands <00:05:49.710>for <00:05:49.885>JavaScript <00:05:50.060>object <00:05:50.234>notation.

112
00:05:53.155 --> 00:05:56.295
<00:05:53.155>So <00:05:53.310>it's <00:05:53.466>kind <00:05:53.621>of <00:05:53.777>is, <00:05:53.932>uh, <00:05:54.088>inspired <00:05:54.243>by <00:05:54.399>the <00:05:54.554>JavaScript,

113
00:05:56.795 --> 00:05:58.205
<00:05:56.795>um, <00:05:58.063>specification.

114
00:05:59.545 --> 00:06:00.765
<00:05:59.545>But <00:05:59.911>long <00:06:00.277>story <00:06:00.643>short,

115
00:06:00.835 --> 00:06:03.285
<00:06:00.835>what <00:06:01.010>we <00:06:01.185>are <00:06:01.359>seeing <00:06:01.534>here <00:06:01.710>are <00:06:01.885>key <00:06:02.060>value <00:06:02.234>pairs.

116
00:06:03.705 --> 00:06:06.965
<00:06:03.705>And <00:06:03.832>the <00:06:03.959>values <00:06:04.086>can <00:06:04.214>be <00:06:04.341>anything <00:06:04.468>from <00:06:04.595>a <00:06:04.723>string <00:06:04.850>to <00:06:04.977>a <00:06:05.104>number

117
00:06:07.185 --> 00:06:11.645
<00:06:07.185>to <00:06:07.418>an <00:06:07.651>array <00:06:07.885>to, <00:06:08.118>um, <00:06:08.351>nested <00:06:08.585>objects

118
00:06:11.665 --> 00:06:14.765
<00:06:11.665>or <00:06:11.840>nested <00:06:12.015>documents <00:06:12.190>as <00:06:12.365>we <00:06:12.540>see <00:06:12.715>the <00:06:12.890>reviews <00:06:13.065>here.

119
00:06:14.825 --> 00:06:18.725
<00:06:14.825>So <00:06:14.965>we <00:06:15.104>have <00:06:15.245>an <00:06:15.385>array <00:06:15.525>of <00:06:15.664>nested <00:06:15.805>documents <00:06:15.945>or <00:06:16.085>sub <00:06:16.224>documents.

120
00:06:20.305 --> 00:06:21.645
<00:06:20.305>So <00:06:20.606>it's, <00:06:20.908>it's <00:06:21.209>very <00:06:21.510>simple.

121
00:06:23.495 --> 00:06:27.055
<00:06:23.495>It <00:06:23.670>looks <00:06:23.845>a <00:06:24.020>lot <00:06:24.195>like <00:06:24.370>an <00:06:24.545>object <00:06:24.720>this <00:06:24.895>documenting.

122
00:06:28.315 --> 00:06:30.335
<00:06:28.315>And <00:06:28.594>what <00:06:28.875>is <00:06:29.155>more <00:06:29.435>important <00:06:29.715>is

123
00:06:30.335 --> 00:06:33.135
<00:06:30.335>that <00:06:30.534>we <00:06:30.734>can <00:06:30.935>group <00:06:31.135>documents <00:06:31.335>together <00:06:31.534>in <00:06:31.734>collections

124
00:06:33.675 --> 00:06:37.695
<00:06:33.675>so <00:06:33.850>we <00:06:34.025>can <00:06:34.200>select <00:06:34.375>a <00:06:34.550>few <00:06:34.725>very <00:06:34.900>related <00:06:35.075>documents

125
00:06:37.715 --> 00:06:39.695
<00:06:37.715>and <00:06:37.948>group <00:06:38.181>them <00:06:38.415>in <00:06:38.648>a <00:06:38.881>product <00:06:39.115>collection.

126
00:06:40.865 --> 00:06:43.725
<00:06:40.865>And <00:06:41.005>what <00:06:41.145>is <00:06:41.285>the <00:06:41.425>difference <00:06:41.565>here, <00:06:41.705>if <00:06:41.845>you're <00:06:41.985>coming <00:06:42.125>from <00:06:42.265>a

127
00:06:44.465 --> 00:06:47.925
<00:06:44.465>SQL <00:06:44.745>database <00:06:45.025>background <00:06:45.305>from <00:06:45.585>tables, <00:06:45.865>is

128
00:06:47.925 --> 00:06:50.645
<00:06:47.925>that <00:06:48.275>collections <00:06:48.625>have <00:06:48.975>flexible <00:06:49.325>schemas.

129
00:06:51.185 --> 00:06:53.845
<00:06:51.185>So <00:06:51.535>we <00:06:51.885>can <00:06:52.235>actually, <00:06:52.585>um,

130
00:06:54.905 --> 00:06:56.565
<00:06:54.905>we <00:06:55.184>can <00:06:55.465>actually <00:06:55.744>group <00:06:56.025>together <00:06:56.304>things

131
00:06:56.565 --> 00:07:00.325
<00:06:56.565>that <00:06:56.692>are <00:06:56.819>not <00:06:56.946>really <00:06:57.074>having <00:06:57.201>the <00:06:57.328>same <00:06:57.455>set <00:06:57.583>of <00:06:57.710>key <00:06:57.837>value <00:06:57.965>pairs.

132
00:07:00.865 --> 00:07:02.845
<00:07:00.865>So <00:07:01.098>we <00:07:01.331>can <00:07:01.565>have <00:07:01.798>a <00:07:02.031>products <00:07:02.265>collection

133
00:07:02.845 --> 00:07:05.845
<00:07:02.845>that <00:07:03.045>contains <00:07:03.245>books <00:07:03.445>which <00:07:03.645>have <00:07:03.845>an <00:07:04.045>alter <00:07:04.245>field

134
00:07:06.465 --> 00:07:08.645
<00:07:06.465>and <00:07:06.664>also <00:07:06.864>movies <00:07:07.065>which <00:07:07.265>have <00:07:07.465>a <00:07:07.664>revenue <00:07:07.864>field

135
00:07:08.825 --> 00:07:11.645
<00:07:08.825>and <00:07:09.025>also <00:07:09.224>albums <00:07:09.425>which <00:07:09.625>have <00:07:09.825>two <00:07:10.025>additional <00:07:10.224>fields,

136
00:07:11.645 --> 00:07:13.205
<00:07:11.645>which <00:07:11.995>are <00:07:12.344>artists <00:07:12.695>and <00:07:13.044>label.

137
00:07:13.665 --> 00:07:16.325
<00:07:13.665>And <00:07:13.805>we <00:07:13.945>can <00:07:14.085>group <00:07:14.225>all <00:07:14.365>of <00:07:14.505>these <00:07:14.645>into <00:07:14.785>the <00:07:14.925>same <00:07:15.065>collection.

138
00:07:17.365 --> 00:07:21.265
<00:07:17.365>And <00:07:17.505>this <00:07:17.645>is <00:07:17.785>not <00:07:17.925>possible <00:07:18.065>when, <00:07:18.205>um, <00:07:18.345>SQO <00:07:18.485>databases, <00:07:18.625>you <00:07:18.765>have

139
00:07:21.265 --> 00:07:23.225
<00:07:21.265>to <00:07:21.498>have <00:07:21.731>a <00:07:21.965>fixed <00:07:22.198>rigid <00:07:22.431>schema <00:07:22.664>there.

140
00:07:24.445 --> 00:07:27.305
<00:07:24.445>So <00:07:24.645>this <00:07:24.844>flexible <00:07:25.045>schema <00:07:25.245>kink <00:07:25.445>is <00:07:25.645>really <00:07:25.844>powerful

141
00:07:27.325 --> 00:07:31.425
<00:07:27.325>and <00:07:27.465>we're <00:07:27.604>gonna <00:07:27.745>see <00:07:27.885>some <00:07:28.025>examples <00:07:28.164>of <00:07:28.305>that <00:07:28.445>today <00:07:28.585>that, <00:07:28.724>um,

142
00:07:32.975 --> 00:07:36.685
<00:07:32.975>let's, <00:07:33.150>let's <00:07:33.325>clarify <00:07:33.500>a <00:07:33.675>little <00:07:33.850>bit <00:07:34.025>the <00:07:34.200>flexible <00:07:34.375>schema.

143
00:07:36.685 --> 00:07:40.205
<00:07:36.685>Again, <00:07:36.860>you <00:07:37.035>can <00:07:37.210>have <00:07:37.385>different <00:07:37.560>fields <00:07:37.735>in <00:07:37.910>different <00:07:38.085>documents

144
00:07:40.205 --> 00:07:42.045
<00:07:40.205>and <00:07:40.405>group <00:07:40.604>them <00:07:40.805>together <00:07:41.005>in <00:07:41.205>the <00:07:41.405>same <00:07:41.604>collection,

145
00:07:42.465 --> 00:07:46.165
<00:07:42.465>but <00:07:42.640>that <00:07:42.815>doesn't <00:07:42.990>mean <00:07:43.165>that <00:07:43.340>the <00:07:43.515>database <00:07:43.690>is <00:07:43.865>schemaless.

146
00:07:46.165 --> 00:07:49.565
<00:07:46.165>This <00:07:46.340>is <00:07:46.515>another <00:07:46.690>term <00:07:46.865>that <00:07:47.040>is <00:07:47.215>quite <00:07:47.390>popular, <00:07:47.565>uh,

147
00:07:49.585 --> 00:07:50.805
<00:07:49.585>in <00:07:49.950>the <00:07:50.317>database <00:07:50.683>space.

148
00:07:51.265 --> 00:07:53.645
<00:07:51.265>So <00:07:51.498>every <00:07:51.731>single <00:07:51.965>document <00:07:52.198>has <00:07:52.431>a <00:07:52.664>schema.

149
00:07:53.645 --> 00:07:56.005
<00:07:53.645>This <00:07:53.844>is <00:07:54.044>the <00:07:54.245>set <00:07:54.445>of <00:07:54.645>field <00:07:54.844>develop <00:07:55.044>errors

150
00:07:56.025 --> 00:07:57.485
<00:07:56.025>for <00:07:56.462>this <00:07:56.901>particular <00:07:57.339>document.

151
00:07:57.985 --> 00:08:01.605
<00:07:57.985>So <00:07:58.140>we <00:07:58.296>do <00:07:58.451>have <00:07:58.607>schemas, <00:07:58.762>it's <00:07:58.918>not <00:07:59.073>a <00:07:59.229>schemaless <00:07:59.385>situation,

152
00:08:01.945 --> 00:08:04.525
<00:08:01.945>rather <00:08:02.224>it's <00:08:02.505>a <00:08:02.784>flexible <00:08:03.065>schema <00:08:03.344>situation.

153
00:08:05.425 --> 00:08:08.965
<00:08:05.425>And <00:08:05.625>another <00:08:05.825>important <00:08:06.025>thing <00:08:06.225>is <00:08:06.425>that <00:08:06.625>with <00:08:06.825>MongoDB

154
00:08:08.965 --> 00:08:10.805
<00:08:08.965>and <00:08:09.315>some <00:08:09.664>other <00:08:10.015>document <00:08:10.364>databases,

155
00:08:10.865 --> 00:08:15.645
<00:08:10.865>you <00:08:11.040>can <00:08:11.215>actually <00:08:11.390>add <00:08:11.565>validation, <00:08:11.740>um, <00:08:11.915>to <00:08:12.090>your <00:08:12.265>collection.

156
00:08:15.745 --> 00:08:16.805
<00:08:15.745>So <00:08:16.063>you <00:08:16.381>can <00:08:16.699>kind

157
00:08:16.805 --> 00:08:19.285
<00:08:16.805>of <00:08:16.945>log <00:08:17.085>down <00:08:17.225>the <00:08:17.365>schema <00:08:17.505>at <00:08:17.645>a <00:08:17.785>certain <00:08:17.925>point <00:08:18.065>of <00:08:18.205>time.

158
00:08:19.745 --> 00:08:22.485
<00:08:19.745>You <00:08:19.861>can <00:08:19.978>do <00:08:20.095>it <00:08:20.211>from <00:08:20.328>the <00:08:20.445>beginning, <00:08:20.561>you <00:08:20.678>can <00:08:20.795>do <00:08:20.911>it <00:08:21.028>later <00:08:21.145>on.

159
00:08:22.825 --> 00:08:24.805
<00:08:22.825>So <00:08:23.000>at <00:08:23.175>some, <00:08:23.349>at <00:08:23.525>some <00:08:23.700>point <00:08:23.875>you <00:08:24.050>may <00:08:24.224>say

160
00:08:24.805 --> 00:08:28.605
<00:08:24.805>that <00:08:25.005>you <00:08:25.205>want <00:08:25.405>your <00:08:25.605>products <00:08:25.805>collection <00:08:26.005>to, <00:08:26.205>um,

161
00:08:28.835 --> 00:08:30.485
<00:08:28.835>have <00:08:29.185>a <00:08:29.534>required <00:08:29.885>title <00:08:30.234>field.

162
00:08:30.785 --> 00:08:34.885
<00:08:30.785>And <00:08:30.925>this <00:08:31.065>required <00:08:31.205>title <00:08:31.345>field, <00:08:31.485>uh, <00:08:31.625>should <00:08:31.765>be <00:08:31.905>a <00:08:32.045>type <00:08:32.185>shrink.

163
00:08:34.945 --> 00:08:36.525
<00:08:34.945>And <00:08:35.225>it <00:08:35.505>should <00:08:35.785>be <00:08:36.065>between <00:08:36.345>10

164
00:08:36.745 --> 00:08:40.685
<00:08:36.745>and <00:08:37.025>50, <00:08:37.304>uh, <00:08:37.585>characters <00:08:37.865>of <00:08:38.145>land.

165
00:08:41.105 --> 00:08:45.445
<00:08:41.105>So <00:08:41.260>that <00:08:41.416>kind <00:08:41.571>of <00:08:41.727>validation, <00:08:41.882>um, <00:08:42.038>rule <00:08:42.193>you <00:08:42.349>can <00:08:42.505>add

166
00:08:45.465 --> 00:08:47.125
<00:08:45.465>to <00:08:46.165>your <00:08:46.865>collection.

167
00:08:48.475 --> 00:08:50.455
<00:08:48.475>So <00:08:48.630>you <00:08:48.786>can <00:08:48.941>have <00:08:49.097>as <00:08:49.252>many <00:08:49.408>rules <00:08:49.563>as <00:08:49.719>you <00:08:49.875>want,

168
00:08:50.475 --> 00:08:51.855
<00:08:50.475>you <00:08:50.723>can <00:08:50.971>lock <00:08:51.220>down <00:08:51.468>your <00:08:51.717>schema.

169
00:08:51.855 --> 00:08:53.735
<00:08:51.855>This <00:08:52.205>is <00:08:52.555>another <00:08:52.905>important <00:08:53.255>thing

170
00:08:53.735 --> 00:08:55.325
<00:08:53.735>that <00:08:54.015>they <00:08:54.295>want <00:08:54.575>to <00:08:54.855>mention <00:08:55.135>here.

171
00:08:56.795 --> 00:09:01.165
<00:08:56.795>Alright, <00:08:56.935>so <00:08:57.074>what <00:08:57.214>we <00:08:57.354>have <00:08:57.495>done <00:08:57.635>is <00:08:57.775>we <00:08:57.915>qualify, <00:08:58.055>um, <00:08:58.194>qua

172
00:09:01.715 --> 00:09:04.805
<00:09:01.715>qualified, <00:09:02.415>qualified, <00:09:03.115>qualified.

173
00:09:04.805 --> 00:09:07.365
<00:09:04.805>What <00:09:05.038>is <00:09:05.271>NoSQL? <00:09:05.505>What <00:09:05.738>are <00:09:05.971>document <00:09:06.204>databases?

174
00:09:07.435 --> 00:09:08.485
<00:09:07.435>What <00:09:07.907>are <00:09:08.380>documents

175
00:09:09.025 --> 00:09:11.485
<00:09:09.025>and <00:09:09.199>how <00:09:09.375>we <00:09:09.550>can <00:09:09.725>group <00:09:09.900>them <00:09:10.074>together <00:09:10.250>in <00:09:10.425>collections.

176
00:09:13.175 --> 00:09:16.955
<00:09:13.175>So <00:09:13.349>let's <00:09:13.525>talk <00:09:13.699>about <00:09:13.875>how <00:09:14.050>we <00:09:14.224>can <00:09:14.400>model <00:09:14.574>relationships

177
00:09:17.425 --> 00:09:19.915
<00:09:17.425>between <00:09:17.658>pieces <00:09:17.891>of <00:09:18.125>data <00:09:18.358>in <00:09:18.591>our <00:09:18.824>applications.

178
00:09:20.495 --> 00:09:21.755
<00:09:20.495>So <00:09:20.721>we <00:09:20.948>are <00:09:21.175>working <00:09:21.402>with <00:09:21.629>data,

179
00:09:21.855 --> 00:09:24.675
<00:09:21.855>and <00:09:22.030>data <00:09:22.205>usually <00:09:22.380>represents <00:09:22.555>something <00:09:22.730>in <00:09:22.905>the <00:09:23.080>real <00:09:23.255>world.

180
00:09:24.935 --> 00:09:27.395
<00:09:24.935>So <00:09:25.214>this <00:09:25.494>piece <00:09:25.775>of <00:09:26.055>data, <00:09:26.334>okay,

181
00:09:27.395 --> 00:09:29.795
<00:09:27.395>we're <00:09:27.628>storing <00:09:27.861>different <00:09:28.095>objects <00:09:28.328>in <00:09:28.561>different <00:09:28.795>documents,

182
00:09:29.795 --> 00:09:32.555
<00:09:29.795>but <00:09:29.969>sometimes <00:09:30.145>they <00:09:30.319>need <00:09:30.495>to <00:09:30.670>relate <00:09:30.844>to <00:09:31.020>each <00:09:31.194>other.

183
00:09:34.095 --> 00:09:36.285
<00:09:34.095>Let's <00:09:34.270>see <00:09:34.445>what <00:09:34.620>they <00:09:34.795>mean <00:09:34.970>by <00:09:35.145>exploring <00:09:35.320>the <00:09:35.495>types

184
00:09:36.285 --> 00:09:38.165
<00:09:36.285>of <00:09:36.635>relationships <00:09:36.985>one <00:09:37.334>by <00:09:37.685>one.

185
00:09:39.935 --> 00:09:41.395
<00:09:39.935>And <00:09:40.154>it's <00:09:40.372>funny <00:09:40.592>because <00:09:40.810>the <00:09:41.030>first <00:09:41.249>type

186
00:09:41.395 --> 00:09:44.235
<00:09:41.395>of <00:09:41.628>relationship <00:09:41.861>is <00:09:42.095>actually <00:09:42.328>the <00:09:42.561>one-to-one <00:09:42.795>relationship.

187
00:09:44.305 --> 00:09:47.155
<00:09:44.305>This <00:09:44.444>is <00:09:44.584>the <00:09:44.724>simplest <00:09:44.864>type <00:09:45.005>of <00:09:45.145>relationships <00:09:45.285>that <00:09:45.425>we <00:09:45.564>can <00:09:45.704>have.

188
00:09:48.135 --> 00:09:50.955
<00:09:48.135>For <00:09:48.335>example, <00:09:48.535>a <00:09:48.735>book <00:09:48.935>can <00:09:49.135>have <00:09:49.335>a <00:09:49.535>title

189
00:09:51.255 --> 00:09:53.915
<00:09:51.255>or <00:09:51.410>a <00:09:51.566>book <00:09:51.721>has <00:09:51.877>a <00:09:52.032>title, <00:09:52.188>so <00:09:52.343>it's <00:09:52.499>a <00:09:52.655>must

190
00:09:54.735 --> 00:09:57.355
<00:09:54.735>and <00:09:54.935>a <00:09:55.135>single <00:09:55.335>book <00:09:55.535>has <00:09:55.735>a <00:09:55.935>single <00:09:56.135>title.

191
00:09:57.815 --> 00:10:00.755
<00:09:57.815>That's <00:09:58.015>why <00:09:58.215>we <00:09:58.415>can <00:09:58.615>simply <00:09:58.815>embed <00:09:59.015>the <00:09:59.215>title

192
00:10:01.095 --> 00:10:04.535
<00:10:01.095>inside <00:10:01.295>the <00:10:01.495>book <00:10:01.695>document <00:10:01.895>as <00:10:02.095>simple <00:10:02.295>as <00:10:02.495>that.

193
00:10:04.755 --> 00:10:07.375
<00:10:04.755>So <00:10:04.988>when <00:10:05.221>we're <00:10:05.455>dealing <00:10:05.688>with <00:10:05.921>one-to-one <00:10:06.155>relationship,

194
00:10:07.915 --> 00:10:12.625
<00:10:07.915>we <00:10:08.089>can <00:10:08.265>embed <00:10:08.439>this, <00:10:08.615>um, <00:10:08.790>one <00:10:08.964>of <00:10:09.140>the <00:10:09.314>sides

195
00:10:12.625 --> 00:10:15.905
<00:10:12.625>of <00:10:12.780>the <00:10:12.936>relationships <00:10:13.091>inside <00:10:13.247>the <00:10:13.402>document <00:10:13.558>of <00:10:13.713>the <00:10:13.869>other <00:10:14.025>site.

196
00:10:16.405 --> 00:10:20.735
<00:10:16.405>Simple <00:10:16.545>as <00:10:16.685>that. <00:10:16.824>Uh, <00:10:16.964>let's <00:10:17.105>head <00:10:17.245>to <00:10:17.385>a <00:10:17.525>more <00:10:17.665>complicated <00:10:17.805>type

197
00:10:20.875 --> 00:10:24.495
<00:10:20.875>and <00:10:21.050>one <00:10:21.225>that <00:10:21.400>is <00:10:21.575>the <00:10:21.750>most <00:10:21.925>commonly, <00:10:22.100>um, <00:10:22.275>used

198
00:10:24.495 --> 00:10:26.695
<00:10:24.495>or <00:10:24.845>most <00:10:25.195>commonly <00:10:25.545>occurring <00:10:25.895>type

199
00:10:26.715 --> 00:10:28.575
<00:10:26.715>of <00:10:27.065>relationship <00:10:27.415>in <00:10:27.765>a <00:10:28.115>database,

200
00:10:28.785 --> 00:10:32.535
<00:10:28.785>which <00:10:29.018>is <00:10:29.251>the <00:10:29.485>one-to-many <00:10:29.718>relationship <00:10:29.951>or <00:10:30.185>one-to-one.

201
00:10:34.055 --> 00:10:36.935
<00:10:34.055>A <00:10:34.334>book <00:10:34.614>can <00:10:34.895>have <00:10:35.175>multiple <00:10:35.454>reviews.

202
00:10:37.555 --> 00:10:42.135
<00:10:37.555>So <00:10:37.671>we <00:10:37.788>have <00:10:37.905>a <00:10:38.021>single <00:10:38.138>book <00:10:38.255>document <00:10:38.371>and <00:10:38.488>we <00:10:38.604>have <00:10:38.721>a <00:10:38.838>few <00:10:38.954>reviews

203
00:10:42.315 --> 00:10:45.815
<00:10:42.315>and <00:10:42.442>we <00:10:42.569>have <00:10:42.696>to <00:10:42.824>de <00:10:42.951>de <00:10:43.078>decide <00:10:43.205>how <00:10:43.333>to <00:10:43.460>store <00:10:43.587>these <00:10:43.715>reviews

204
00:10:47.115 --> 00:10:49.935
<00:10:47.115>as <00:10:47.348>related <00:10:47.581>to <00:10:47.815>our <00:10:48.048>books <00:10:48.281>document <00:10:48.515>so

205
00:10:49.935 --> 00:10:51.495
<00:10:49.935>that <00:10:50.214>we <00:10:50.494>can <00:10:50.775>retrieve <00:10:51.055>them <00:10:51.334>later

206
00:10:51.755 --> 00:10:53.655
<00:10:51.755>and <00:10:51.988>connect <00:10:52.221>them <00:10:52.455>somehow <00:10:52.688>to <00:10:52.921>this <00:10:53.155>book

207
00:10:53.755 --> 00:10:55.615
<00:10:53.755>and <00:10:53.988>maybe <00:10:54.221>display <00:10:54.455>them <00:10:54.688>to <00:10:54.921>our <00:10:55.155>user.

208
00:10:58.465 --> 00:11:01.725
<00:10:58.465>And <00:10:58.605>with <00:10:58.745>document <00:10:58.885>databases, <00:10:59.025>we <00:10:59.165>have <00:10:59.305>two <00:10:59.445>options <00:10:59.585>to <00:10:59.725>do <00:10:59.865>that.

209
00:11:01.785 --> 00:11:06.245
<00:11:01.785>We <00:11:01.912>have, <00:11:02.039>we <00:11:02.166>can <00:11:02.294>embed <00:11:02.421>them <00:11:02.548>or <00:11:02.675>we <00:11:02.803>can <00:11:02.930>also <00:11:03.057>use <00:11:03.185>referencing.

210
00:11:07.505 --> 00:11:09.975
<00:11:07.505>Let's <00:11:07.680>see <00:11:07.855>what, <00:11:08.030>what <00:11:08.205>each <00:11:08.380>of <00:11:08.555>these <00:11:08.730>mean <00:11:08.905>actually.

211
00:11:12.605 --> 00:11:16.225
<00:11:12.605>So <00:11:12.805>with <00:11:13.005>embedding, <00:11:13.205>we <00:11:13.405>can <00:11:13.605>take <00:11:13.805>all <00:11:14.005>reviews

212
00:11:16.445 --> 00:11:19.745
<00:11:16.445>and <00:11:16.600>put <00:11:16.756>them <00:11:16.911>inside <00:11:17.067>an <00:11:17.222>array <00:11:17.378>inside <00:11:17.533>our <00:11:17.689>book <00:11:17.845>document.

213
00:11:20.285 --> 00:11:22.385
<00:11:20.285>So <00:11:20.459>this <00:11:20.635>is <00:11:20.810>called <00:11:20.985>embedding <00:11:21.160>on <00:11:21.334>the <00:11:21.510>one <00:11:21.685>site

214
00:11:22.385 --> 00:11:24.665
<00:11:22.385>because <00:11:22.618>the <00:11:22.851>one <00:11:23.085>site <00:11:23.318>is <00:11:23.551>the <00:11:23.785>book

215
00:11:24.725 --> 00:11:27.905
<00:11:24.725>and <00:11:24.880>we <00:11:25.036>are <00:11:25.191>embedding <00:11:25.347>all <00:11:25.502>the <00:11:25.658>reviews, <00:11:25.813>the <00:11:25.969>many <00:11:26.125>site

216
00:11:28.085 --> 00:11:30.905
<00:11:28.085>inside <00:11:28.318>this <00:11:28.551>book, <00:11:28.785>as <00:11:29.018>simple <00:11:29.251>as <00:11:29.485>that.

217
00:11:31.845 --> 00:11:35.505
<00:11:31.845>But <00:11:32.000>we <00:11:32.156>can <00:11:32.311>also <00:11:32.467>do <00:11:32.622>embedding <00:11:32.778>on <00:11:32.933>the <00:11:33.089>many <00:11:33.245>site.

218
00:11:35.765 --> 00:11:38.985
<00:11:35.765>And <00:11:35.920>in <00:11:36.076>this <00:11:36.231>case, <00:11:36.387>we <00:11:36.542>are <00:11:36.698>embedding <00:11:36.853>the <00:11:37.009>book <00:11:37.165>document

219
00:11:39.285 --> 00:11:41.265
<00:11:39.285>inside <00:11:39.635>every <00:11:39.985>single <00:11:40.334>review <00:11:40.685>document.

220
00:11:41.325 --> 00:11:44.545
<00:11:41.325>And <00:11:41.452>we <00:11:41.579>are, <00:11:41.706>we <00:11:41.834>are <00:11:41.961>storing <00:11:42.088>it <00:11:42.215>that <00:11:42.343>way <00:11:42.470>in <00:11:42.597>the <00:11:42.725>database.

221
00:11:45.485 --> 00:11:47.505
<00:11:45.485>So <00:11:45.685>this <00:11:45.885>is <00:11:46.085>embedding <00:11:46.285>on <00:11:46.485>the <00:11:46.685>many <00:11:46.885>side.

222
00:11:49.535 --> 00:11:50.825
<00:11:49.535>What <00:11:50.115>about <00:11:50.696>referencing?

223
00:11:51.015 --> 00:11:53.145
<00:11:51.015>Well, <00:11:51.295>when <00:11:51.574>we're <00:11:51.855>dealing <00:11:52.135>with <00:11:52.415>referencing

224
00:11:53.205 --> 00:11:55.845
<00:11:53.205>where <00:11:53.438>we <00:11:53.671>are <00:11:53.905>usually <00:11:54.138>doing <00:11:54.371>with <00:11:54.605>IDs

225
00:11:56.425 --> 00:12:00.365
<00:11:56.425>or <00:11:56.599>some <00:11:56.775>identifiers <00:11:56.949>for <00:11:57.125>our <00:11:57.300>documents, <00:11:57.474>in <00:11:57.650>this <00:11:57.824>case,

226
00:12:00.785 --> 00:12:05.085
<00:12:00.785>we <00:12:00.959>have <00:12:01.135>review <00:12:01.310>IDs <00:12:01.485>inside <00:12:01.660>every <00:12:01.834>single <00:12:02.010>review <00:12:02.185>document.

227
00:12:05.785 --> 00:12:10.445
<00:12:05.785>And <00:12:05.912>then <00:12:06.039>we <00:12:06.166>are <00:12:06.294>putting <00:12:06.421>these <00:12:06.548>review <00:12:06.675>id <00:12:06.803>inside <00:12:06.930>the <00:12:07.057>book <00:12:07.185>that

228
00:12:11.115 --> 00:12:16.105
<00:12:11.115>that <00:12:11.315>actually, <00:12:11.515>um, <00:12:11.715>that <00:12:11.915>these <00:12:12.115>reviews <00:12:12.315>are <00:12:12.515>for.

229
00:12:17.205 --> 00:12:21.625
<00:12:17.205>So <00:12:17.332>our <00:12:17.459>book <00:12:17.586>has <00:12:17.714>an <00:12:17.841>array <00:12:17.968>of <00:12:18.095>ideas <00:12:18.223>for <00:12:18.350>every <00:12:18.477>single <00:12:18.605>review

230
00:12:21.695 --> 00:12:23.745
<00:12:21.695>that <00:12:21.975>is <00:12:22.255>actually <00:12:22.535>for <00:12:22.815>this <00:12:23.095>book.

231
00:12:24.365 --> 00:12:26.425
<00:12:24.365>And <00:12:24.565>this <00:12:24.765>is <00:12:24.965>referencing <00:12:25.165>on <00:12:25.365>the <00:12:25.565>one <00:12:25.765>side

232
00:12:26.425 --> 00:12:30.185
<00:12:26.425>because <00:12:26.625>we <00:12:26.824>are <00:12:27.025>storing <00:12:27.224>all <00:12:27.425>the <00:12:27.625>ideas <00:12:27.824>for

233
00:12:31.005 --> 00:12:34.105
<00:12:31.005>all <00:12:31.205>the <00:12:31.405>reviews, <00:12:31.605>the <00:12:31.805>many <00:12:32.005>site <00:12:32.205>inside <00:12:32.405>the

234
00:12:34.735 --> 00:12:36.185
<00:12:34.735>book <00:12:35.061>document, <00:12:35.387>the <00:12:35.713>one <00:12:36.040>site.

235
00:12:38.975 --> 00:12:41.875
<00:12:38.975>The <00:12:39.115>other <00:12:39.255>side <00:12:39.395>of <00:12:39.535>the <00:12:39.675>coin <00:12:39.815>is <00:12:39.955>referencing <00:12:40.095>condom <00:12:40.235>many <00:12:40.375>site.

236
00:12:41.895 --> 00:12:45.355
<00:12:41.895>So <00:12:42.002>here <00:12:42.110>we <00:12:42.218>have <00:12:42.325>a <00:12:42.433>book <00:12:42.541>ID <00:12:42.648>that <00:12:42.756>is <00:12:42.864>the <00:12:42.971>noting, <00:12:43.079>this <00:12:43.187>is <00:12:43.295>the

237
00:12:45.915 --> 00:12:47.435
<00:12:45.915>identifier <00:12:46.257>for <00:12:46.598>this <00:12:46.940>particular <00:12:47.282>book.

238
00:12:48.015 --> 00:12:52.035
<00:12:48.015>And <00:12:48.155>we're <00:12:48.295>using <00:12:48.435>this <00:12:48.574>book <00:12:48.715>Id <00:12:48.855>to <00:12:48.995>refer <00:12:49.135>to <00:12:49.275>the <00:12:49.415>book

239
00:12:52.135 --> 00:12:54.475
<00:12:52.135>inside <00:12:52.415>every <00:12:52.694>review <00:12:52.975>for <00:12:53.255>that <00:12:53.535>book.

240
00:12:56.035 --> 00:12:57.495
<00:12:56.035>And <00:12:56.363>when <00:12:56.692>we <00:12:57.020>have <00:12:57.349>referencing,

241
00:12:57.495 --> 00:13:00.215
<00:12:57.495>obviously <00:12:57.670>we <00:12:57.845>don't <00:12:58.020>have <00:12:58.195>all <00:12:58.370>the <00:12:58.545>needed <00:12:58.720>information <00:12:58.895>about,

242
00:13:00.635 --> 00:13:04.415
<00:13:00.635>um, <00:13:00.810>all <00:13:00.985>the, <00:13:01.160>uh, <00:13:01.335>related <00:13:01.510>data <00:13:01.685>inside <00:13:01.860>our <00:13:02.035>reviews.

243
00:13:04.595 --> 00:13:08.295
<00:13:04.595>So <00:13:04.795>if <00:13:04.995>we <00:13:05.195>want <00:13:05.395>to, <00:13:05.595>um, <00:13:05.795>display <00:13:05.995>play

244
00:13:09.765 --> 00:13:12.955
<00:13:09.765>additional <00:13:09.965>information, <00:13:10.165>if <00:13:10.365>we <00:13:10.564>have <00:13:10.765>the <00:13:10.965>review <00:13:11.165>document

245
00:13:12.955 --> 00:13:16.475
<00:13:12.955>and <00:13:13.110>we <00:13:13.266>want <00:13:13.421>to, <00:13:13.577>uh, <00:13:13.732>display <00:13:13.888>additional <00:13:14.043>information <00:13:14.199>about <00:13:14.355>the

246
00:13:16.475 --> 00:13:18.075
<00:13:16.475>book, <00:13:16.708>we <00:13:16.941>can <00:13:17.175>grab <00:13:17.408>the <00:13:17.641>book <00:13:17.875>ID

247
00:13:18.335 --> 00:13:21.355
<00:13:18.335>and <00:13:18.510>make <00:13:18.685>a <00:13:18.860>separate <00:13:19.035>query <00:13:19.210>for <00:13:19.385>the <00:13:19.560>book <00:13:19.735>so

248
00:13:21.355 --> 00:13:24.435
<00:13:21.355>that <00:13:21.635>we <00:13:21.915>can <00:13:22.195>obtain <00:13:22.475>additional <00:13:22.755>information,

249
00:13:24.505 --> 00:13:25.755
<00:13:24.505>like <00:13:24.730>we <00:13:24.955>can <00:13:25.180>find <00:13:25.405>the <00:13:25.630>book

250
00:13:25.935 --> 00:13:28.395
<00:13:25.935>and <00:13:26.074>then <00:13:26.214>we <00:13:26.354>can <00:13:26.494>display <00:13:26.635>it <00:13:26.775>whatever <00:13:26.915>we <00:13:27.055>want <00:13:27.194>about <00:13:27.334>it.

251
00:13:29.095 --> 00:13:31.635
<00:13:29.095>We <00:13:29.295>can <00:13:29.495>also <00:13:29.695>use <00:13:29.895>the <00:13:30.095>door <00:13:30.295>lookup <00:13:30.495>operator,

252
00:13:31.645 --> 00:13:36.315
<00:13:31.645>which <00:13:31.800>is <00:13:31.956>a <00:13:32.111>specific <00:13:32.267>operator <00:13:32.422>in <00:13:32.578>Hmong <00:13:32.733>GB <00:13:32.889>to <00:13:33.045>resolve

253
00:13:36.855 --> 00:13:38.355
<00:13:36.855>the, <00:13:37.305>um, <00:13:37.755>the <00:13:38.205>book.

254
00:13:38.695 --> 00:13:41.195
<00:13:38.695>It <00:13:38.928>is <00:13:39.161>similar <00:13:39.395>to <00:13:39.628>joins. <00:13:39.861>Hold <00:13:40.095>on.

255
00:13:41.195 --> 00:13:43.595
<00:13:41.195>Not <00:13:41.350>the <00:13:41.506>same <00:13:41.661>if <00:13:41.817>you're <00:13:41.972>coming <00:13:42.128>from <00:13:42.283>a <00:13:42.439>relational <00:13:42.595>background.

256
00:13:46.405 --> 00:13:48.895
<00:13:46.405>Alright, <00:13:46.685>let's <00:13:46.964>summarize <00:13:47.245>what <00:13:47.525>we <00:13:47.805>have

257
00:13:48.895 --> 00:13:50.375
<00:13:48.895>with <00:13:49.339>embedding <00:13:49.783>Ken <00:13:50.227>referencing.

258
00:13:50.915 --> 00:13:52.015
<00:13:50.915>So <00:13:51.245>when <00:13:51.574>we're <00:13:51.905>embedding,

259
00:13:52.015 --> 00:13:53.735
<00:13:52.015>we're <00:13:52.248>storing <00:13:52.481>everything <00:13:52.715>in <00:13:52.948>the <00:13:53.181>same <00:13:53.415>document.

260
00:13:53.875 --> 00:13:55.455
<00:13:53.875>So <00:13:54.108>we <00:13:54.341>need <00:13:54.575>just <00:13:54.808>a <00:13:55.041>single <00:13:55.275>query

261
00:13:55.535 --> 00:13:57.095
<00:13:55.535>throught <00:13:55.814>three <00:13:56.094>for <00:13:56.375>the <00:13:56.655>needed <00:13:56.935>data.

262
00:13:57.915 --> 00:13:59.815
<00:13:57.915>And <00:13:58.148>we <00:13:58.381>need <00:13:58.615>just <00:13:58.848>a <00:13:59.081>single <00:13:59.314>operation

263
00:13:59.835 --> 00:14:01.495
<00:13:59.835>for <00:14:00.185>updating <00:14:00.535>or <00:14:00.885>deleting <00:14:01.235>data.

264
00:14:01.595 --> 00:14:03.495
<00:14:01.595>So <00:14:01.750>if <00:14:01.906>we <00:14:02.061>wanna <00:14:02.217>add <00:14:02.372>a <00:14:02.528>review, <00:14:02.683>we <00:14:02.839>can <00:14:02.995>just

265
00:14:04.035 --> 00:14:08.615
<00:14:04.035>update <00:14:04.190>the <00:14:04.346>book <00:14:04.501>documents <00:14:04.657>and <00:14:04.812>add <00:14:04.968>a <00:14:05.123>new <00:14:05.279>review <00:14:05.435>documents

266
00:14:08.615 --> 00:14:12.215
<00:14:08.615>because <00:14:08.770>these <00:14:08.926>are <00:14:09.081>all <00:14:09.237>nested <00:14:09.392>within <00:14:09.548>the <00:14:09.703>same <00:14:09.859>book <00:14:10.015>documents.

267
00:14:13.395 --> 00:14:16.495
<00:14:13.395>The <00:14:13.569>disadvantage <00:14:13.745>is <00:14:13.920>that <00:14:14.095>we <00:14:14.270>have <00:14:14.444>some <00:14:14.620>data <00:14:14.795>duplication.

268
00:14:17.195 --> 00:14:19.135
<00:14:17.195>We <00:14:17.475>may <00:14:17.755>have <00:14:18.035>some <00:14:18.315>data <00:14:18.595>duplication

269
00:14:19.135 --> 00:14:22.335
<00:14:19.135>as <00:14:19.290>we <00:14:19.446>saw <00:14:19.601>when <00:14:19.757>we <00:14:19.912>are <00:14:20.068>embedding <00:14:20.223>all <00:14:20.379>the, <00:14:20.535>um,

270
00:14:23.075 --> 00:14:26.055
<00:14:23.075>for <00:14:23.215>all <00:14:23.355>the <00:14:23.495>review <00:14:23.635>documents <00:14:23.775>when <00:14:23.915>we <00:14:24.055>are <00:14:24.195>embedding <00:14:24.335>the <00:14:24.475>book

271
00:14:26.295 --> 00:14:28.455
<00:14:26.295>document <00:14:26.574>inside <00:14:26.854>every <00:14:27.135>single <00:14:27.415>review <00:14:27.694>document,

272
00:14:28.595 --> 00:14:31.455
<00:14:28.595>we <00:14:28.828>are <00:14:29.061>duplicating <00:14:29.295>information <00:14:29.528>about <00:14:29.761>this <00:14:29.995>book.

273
00:14:31.595 --> 00:14:33.855
<00:14:31.595>So <00:14:31.795>this <00:14:31.995>is <00:14:32.195>what <00:14:32.395>is <00:14:32.595>causing <00:14:32.795>data <00:14:32.995>duplication.

274
00:14:35.625 --> 00:14:38.565
<00:14:35.625>And <00:14:35.765>the <00:14:35.905>other <00:14:36.045>problem <00:14:36.185>that <00:14:36.325>we <00:14:36.465>may <00:14:36.605>have <00:14:36.745>is <00:14:36.885>watch <00:14:37.025>documents.

275
00:14:39.065 --> 00:14:42.045
<00:14:39.065>So <00:14:39.265>if <00:14:39.465>we <00:14:39.665>embed <00:14:39.865>every <00:14:40.065>single <00:14:40.265>review <00:14:40.465>document

276
00:14:42.145 --> 00:14:44.965
<00:14:42.145>inside <00:14:42.345>our <00:14:42.545>book <00:14:42.745>documents, <00:14:42.944>this <00:14:43.145>is <00:14:43.345>gonna <00:14:43.545>lead

277
00:14:45.085 --> 00:14:46.365
<00:14:45.085>to <00:14:45.373>a <00:14:45.661>pretty <00:14:45.949>large <00:14:46.237>document.

278
00:14:46.585 --> 00:14:51.325
<00:14:46.585>If <00:14:46.740>we <00:14:46.896>are <00:14:47.051>dealing <00:14:47.207>with <00:14:47.362>tens <00:14:47.518>of <00:14:47.673>thousands <00:14:47.829>of <00:14:47.985>hundreds

279
00:14:51.385 --> 00:14:54.845
<00:14:51.385>or <00:14:51.512>even <00:14:51.639>millions <00:14:51.766>of <00:14:51.894>reviews, <00:14:52.021>this <00:14:52.148>is <00:14:52.275>gonna <00:14:52.403>lead <00:14:52.530>to <00:14:52.657>one <00:14:52.785>very,

280
00:14:54.845 --> 00:14:56.485
<00:14:54.845>very <00:14:55.311>large <00:14:55.778>book <00:14:56.245>document

281
00:14:56.485 --> 00:14:58.445
<00:14:56.485>because <00:14:56.765>we're <00:14:57.045>putting <00:14:57.325>everything <00:14:57.605>inside <00:14:57.885>it.

282
00:15:00.135 --> 00:15:02.225
<00:15:00.135>Alright, <00:15:00.368>what <00:15:00.601>is <00:15:00.835>the <00:15:01.068>deal <00:15:01.301>with <00:15:01.535>referencing?

283
00:15:02.365 --> 00:15:03.665
<00:15:02.365>We <00:15:02.657>don't <00:15:02.950>have <00:15:03.242>any <00:15:03.535>duplication

284
00:15:03.905 --> 00:15:04.945
<00:15:03.905>'cause <00:15:04.217>we're <00:15:04.529>only <00:15:04.841>dealing

285
00:15:04.975 --> 00:15:07.465
<00:15:04.975>with <00:15:05.208>these <00:15:05.441>ideas <00:15:05.675>when <00:15:05.908>we're <00:15:06.141>using <00:15:06.375>referencing.

286
00:15:07.645 --> 00:15:10.345
<00:15:07.645>We <00:15:07.845>have <00:15:08.045>smaller <00:15:08.245>documents <00:15:08.444>for <00:15:08.645>the <00:15:08.845>same <00:15:09.045>reason,

287
00:15:11.365 --> 00:15:14.625
<00:15:11.365>but <00:15:11.520>we <00:15:11.676>need <00:15:11.831>to <00:15:11.987>join <00:15:12.142>data <00:15:12.298>from <00:15:12.453>multiple <00:15:12.609>documents, <00:15:12.765>either

288
00:15:14.725 --> 00:15:16.665
<00:15:14.725>by <00:15:14.958>using <00:15:15.191>the <00:15:15.425>door <00:15:15.658>woke <00:15:15.891>up <00:15:16.125>operator,

289
00:15:16.885 --> 00:15:20.465
<00:15:16.885>or <00:15:17.165>by <00:15:17.444>performing, <00:15:17.725>um, <00:15:18.005>another <00:15:18.285>query.

290
00:15:22.615 --> 00:15:25.875
<00:15:22.615>So <00:15:22.770>that <00:15:22.926>doesn't <00:15:23.081>really <00:15:23.237>answer <00:15:23.392>the <00:15:23.548>question <00:15:23.703>which <00:15:23.859>one <00:15:24.015>we

291
00:15:25.875 --> 00:15:28.195
<00:15:25.875>should <00:15:26.075>use <00:15:26.275>when <00:15:26.475>modeling <00:15:26.675>the <00:15:26.875>one <00:15:27.075>too <00:15:27.275>many

292
00:15:28.435 --> 00:15:29.635
<00:15:28.435>relationship <00:15:29.515>though.

293
00:15:30.455 --> 00:15:34.675
<00:15:30.455>So <00:15:30.630>how <00:15:30.805>do <00:15:30.980>we <00:15:31.155>decide <00:15:31.330>between <00:15:31.505>embedding <00:15:31.680>and <00:15:31.855>referencing?

294
00:15:36.735 --> 00:15:40.905
<00:15:36.735>Well, <00:15:36.910>we <00:15:37.085>need <00:15:37.260>to <00:15:37.435>look <00:15:37.610>at <00:15:37.785>the <00:15:37.960>different <00:15:38.135>characteristic

295
00:15:41.365 --> 00:15:45.025
<00:15:41.365>of <00:15:41.565>the <00:15:41.765>relationship <00:15:41.965>so <00:15:42.165>we <00:15:42.365>can, <00:15:42.565>we <00:15:42.765>have

296
00:15:45.025 --> 00:15:47.065
<00:15:45.025>to <00:15:45.225>look <00:15:45.425>at <00:15:45.625>the <00:15:45.824>cardinality <00:15:46.025>of <00:15:46.225>the <00:15:46.425>relationship.

297
00:15:47.525 --> 00:15:50.785
<00:15:47.525>And <00:15:47.665>when <00:15:47.805>we <00:15:47.944>look <00:15:48.084>at <00:15:48.225>the <00:15:48.365>cardinality, <00:15:48.505>we <00:15:48.645>can <00:15:48.785>basically, <00:15:48.925>uh,

298
00:15:50.875 --> 00:15:54.225
<00:15:50.875>split <00:15:51.050>the <00:15:51.225>one <00:15:51.400>to <00:15:51.575>many <00:15:51.750>relationship <00:15:51.925>into <00:15:52.100>three <00:15:52.275>different

299
00:15:54.225 --> 00:15:58.225
<00:15:54.225>types <00:15:54.365>of <00:15:54.505>relationships, <00:15:54.645>which <00:15:54.785>are <00:15:54.925>one <00:15:55.065>to <00:15:55.205>few, <00:15:55.345>one <00:15:55.485>to <00:15:55.625>many,

300
00:15:58.245 --> 00:15:59.265
<00:15:58.245>and <00:15:58.551>one <00:15:58.857>to <00:15:59.163>zillions.

301
00:16:00.885 --> 00:16:02.705
<00:16:00.885>So <00:16:01.165>let's <00:16:01.444>handle <00:16:01.725>the <00:16:02.005>extremes <00:16:02.285>first.

302
00:16:02.795 --> 00:16:05.225
<00:16:02.795>We're <00:16:02.969>gonna <00:16:03.145>start <00:16:03.319>from <00:16:03.495>one <00:16:03.670>to <00:16:03.844>many, <00:16:04.020>uh, <00:16:04.194>one

303
00:16:05.225 --> 00:16:07.505
<00:16:05.225>to <00:16:05.575>few, <00:16:05.925>one <00:16:06.275>to <00:16:06.625>few.

304
00:16:08.205 --> 00:16:11.225
<00:16:08.205>Um, <00:16:08.380>usually <00:16:08.555>the <00:16:08.730>notes <00:16:08.905>data <00:16:09.080>that <00:16:09.255>is <00:16:09.430>accessed <00:16:09.605>together

305
00:16:11.245 --> 00:16:13.505
<00:16:11.245>and <00:16:11.478>belongs <00:16:11.711>to <00:16:11.945>one <00:16:12.178>system, <00:16:12.411>logical <00:16:12.645>unit.

306
00:16:13.965 --> 00:16:16.985
<00:16:13.965>For <00:16:14.120>example, <00:16:14.276>we <00:16:14.431>can <00:16:14.587>have <00:16:14.742>a <00:16:14.898>book <00:16:15.053>and <00:16:15.209>it's <00:16:15.365>genres.

307
00:16:17.445 --> 00:16:20.025
<00:16:17.445>So <00:16:17.572>we <00:16:17.699>have <00:16:17.826>just <00:16:17.954>a <00:16:18.081>couple <00:16:18.208>of <00:16:18.335>genres <00:16:18.463>maybe <00:16:18.590>for <00:16:18.717>a <00:16:18.845>book.

308
00:16:20.645 --> 00:16:24.185
<00:16:20.645>And <00:16:20.819>another <00:16:20.995>example <00:16:21.170>is <00:16:21.345>a <00:16:21.520>user <00:16:21.694>and <00:16:21.870>their <00:16:22.045>addresses.

309
00:16:24.765 --> 00:16:29.385
<00:16:24.765>So <00:16:24.892>usually <00:16:25.019>a <00:16:25.146>user <00:16:25.274>can <00:16:25.401>have <00:16:25.528>two <00:16:25.655>or <00:16:25.783>three <00:16:25.910>addresses <00:16:26.037>at <00:16:26.165>most.

310
00:16:29.605 --> 00:16:32.425
<00:16:29.605>So <00:16:29.745>this <00:16:29.885>is <00:16:30.025>why <00:16:30.165>we're <00:16:30.305>saying, <00:16:30.445>uh, <00:16:30.585>it <00:16:30.725>is <00:16:30.865>a <00:16:31.005>one

311
00:16:32.425 --> 00:16:33.665
<00:16:32.425>to <00:16:32.983>few <00:16:33.540>relationship.

312
00:16:36.225 --> 00:16:39.955
<00:16:36.225>Alright, <00:16:36.400>so <00:16:36.575>again, <00:16:36.750>access <00:16:36.925>together <00:16:37.100>belongs <00:16:37.275>to <00:16:37.450>one <00:16:37.625>system.

313
00:16:39.985 --> 00:16:43.115
<00:16:39.985>Unit. <00:16:40.140>This <00:16:40.296>is, <00:16:40.451>this <00:16:40.607>is <00:16:40.762>a <00:16:40.918>characteristic <00:16:41.073>for <00:16:41.229>the <00:16:41.385>one

314
00:16:43.115 --> 00:16:44.115
<00:16:43.115>to <00:16:43.565>few <00:16:44.015>relationship.

315
00:16:44.855 --> 00:16:46.435
<00:16:44.855>And <00:16:45.135>how <00:16:45.415>do <00:16:45.695>we <00:16:45.975>model <00:16:46.255>that?

316
00:16:47.145 --> 00:16:50.155
<00:16:47.145>Well, <00:16:47.345>the <00:16:47.545>correct <00:16:47.745>answer <00:16:47.944>is <00:16:48.145>to <00:16:48.345>use <00:16:48.545>embedding

317
00:16:50.255 --> 00:16:52.315
<00:16:50.255>and <00:16:50.430>we <00:16:50.605>have <00:16:50.780>to <00:16:50.955>embed <00:16:51.130>on <00:16:51.305>the <00:16:51.480>one <00:16:51.655>site

318
00:16:53.375 --> 00:16:56.825
<00:16:53.375>because, <00:16:53.550>uh, <00:16:53.725>the <00:16:53.900>one <00:16:54.075>site <00:16:54.250>is <00:16:54.425>usually <00:16:54.600>the <00:16:54.775>thing

319
00:16:56.825 --> 00:16:58.905
<00:16:56.825>that <00:16:57.000>we're <00:16:57.175>gonna <00:16:57.350>need <00:16:57.525>to <00:16:57.700>show <00:16:57.875>to <00:16:58.050>the <00:16:58.225>user.

320
00:17:00.625 --> 00:17:03.285
<00:17:00.625>And, <00:17:00.825>uh, <00:17:01.025>what <00:17:01.225>is <00:17:01.425>the <00:17:01.625>benefit <00:17:01.825>here <00:17:02.025>is

321
00:17:03.285 --> 00:17:06.085
<00:17:03.285>that <00:17:03.459>the <00:17:03.635>information <00:17:03.810>is <00:17:03.985>accessed <00:17:04.159>together <00:17:04.335>with <00:17:04.510>one <00:17:04.685>query.

322
00:17:06.225 --> 00:17:08.525
<00:17:06.224>So <00:17:06.380>we <00:17:06.536>can <00:17:06.691>just <00:17:06.847>go <00:17:07.002>and <00:17:07.158>search <00:17:07.313>for <00:17:07.469>the <00:17:07.625>user

323
00:17:08.625 --> 00:17:10.085
<00:17:08.625>and <00:17:08.887>we <00:17:09.150>have <00:17:09.413>all <00:17:09.676>their <00:17:09.939>addresses

324
00:17:10.085 --> 00:17:12.645
<00:17:10.085>that <00:17:10.260>we <00:17:10.435>can <00:17:10.610>display <00:17:10.785>at <00:17:10.960>the <00:17:11.135>user <00:17:11.310>profile <00:17:11.485>page,

325
00:17:13.105 --> 00:17:16.005
<00:17:13.105>and <00:17:13.280>we <00:17:13.454>need <00:17:13.630>just <00:17:13.805>a <00:17:13.980>single <00:17:14.155>request <00:17:14.329>for <00:17:14.505>that.

326
00:17:17.955 --> 00:17:20.495
<00:17:17.954>And <00:17:18.155>the <00:17:18.355>disadvantage <00:17:18.554>is <00:17:18.754>that <00:17:18.954>the <00:17:19.155>embedded <00:17:19.355>documents,

327
00:17:20.495 --> 00:17:22.095
<00:17:20.494>in <00:17:20.694>this <00:17:20.895>case, <00:17:21.094>the <00:17:21.294>addresses <00:17:21.494>for <00:17:21.694>the <00:17:21.895>user

328
00:17:22.715 --> 00:17:24.935
<00:17:22.714>are <00:17:23.181>on <00:17:23.648>standalone <00:17:24.115>entity.

329
00:17:25.155 --> 00:17:28.775
<00:17:25.155>So <00:17:25.295>if <00:17:25.435>we <00:17:25.575>need <00:17:25.714>to <00:17:25.855>work <00:17:25.994>with <00:17:26.135>addresses <00:17:26.274>on <00:17:26.415>their <00:17:26.555>own

330
00:17:28.875 --> 00:17:32.495
<00:17:28.875>and <00:17:29.015>display <00:17:29.155>them <00:17:29.295>somewhere <00:17:29.435>out <00:17:29.575>of <00:17:29.715>the <00:17:29.855>context <00:17:29.995>of <00:17:30.135>this <00:17:30.275>user,

331
00:17:33.165 --> 00:17:34.735
<00:17:33.165>it's, <00:17:33.365>it's <00:17:33.565>gonna <00:17:33.764>be <00:17:33.965>hard <00:17:34.165>to <00:17:34.365>do <00:17:34.565>that

332
00:17:34.735 --> 00:17:37.295
<00:17:34.735>because <00:17:34.890>we <00:17:35.046>have <00:17:35.201>to <00:17:35.357>extract <00:17:35.512>them <00:17:35.668>from <00:17:35.823>the <00:17:35.979>user <00:17:36.135>document.

333
00:17:40.115 --> 00:17:42.615
<00:17:40.115>And <00:17:40.348>okay, <00:17:40.581>we <00:17:40.815>have <00:17:41.048>one <00:17:41.281>to <00:17:41.515>few.

334
00:17:43.075 --> 00:17:46.095
<00:17:43.075>Um, <00:17:43.215>the <00:17:43.355>right <00:17:43.495>solution <00:17:43.635>is <00:17:43.775>to <00:17:43.915>embed <00:17:44.055>on <00:17:44.195>the <00:17:44.335>one <00:17:44.475>side.

335
00:17:47.045 --> 00:17:49.445
<00:17:47.045>What <00:17:47.245>about <00:17:47.445>the <00:17:47.645>other <00:17:47.845>extreme? <00:17:48.045>One, <00:17:48.245>two <00:17:48.445>zillions.

336
00:17:50.365 --> 00:17:51.525
<00:17:50.365>Zillions <00:17:50.626>is <00:17:50.887>a <00:17:51.148>funny <00:17:51.409>word.

337
00:17:51.745 --> 00:17:55.165
<00:17:51.745>It <00:17:51.900>means <00:17:52.056>a <00:17:52.211>possibly <00:17:52.367>very <00:17:52.522>large <00:17:52.678>number <00:17:52.833>of <00:17:52.989>connected <00:17:53.145>items.

338
00:17:55.385 --> 00:17:57.125
<00:17:55.385>So <00:17:55.618>let's <00:17:55.851>give, <00:17:56.085>let's <00:17:56.318>see <00:17:56.551>an <00:17:56.785>example

339
00:17:57.125 --> 00:17:59.005
<00:17:57.125>because <00:17:57.300>it's <00:17:57.475>gonna <00:17:57.650>make <00:17:57.825>it <00:17:58.000>a <00:17:58.175>lot <00:17:58.350>more <00:17:58.525>clear.

340
00:17:59.985 --> 00:18:02.325
<00:17:59.985>Um, <00:18:00.159>for <00:18:00.334>example, <00:18:00.510>we <00:18:00.685>can <00:18:00.860>have <00:18:01.034>a <00:18:01.209>blog <00:18:01.385>post

341
00:18:03.345 --> 00:18:07.085
<00:18:03.345>or <00:18:03.485>an <00:18:03.625>article <00:18:03.765>page <00:18:03.905>that <00:18:04.045>we <00:18:04.185>published <00:18:04.325>on <00:18:04.465>our, <00:18:04.605>um, <00:18:04.745>website.

342
00:18:07.705 --> 00:18:11.285
<00:18:07.705>And <00:18:07.860>we <00:18:08.016>want <00:18:08.171>to <00:18:08.327>track <00:18:08.482>every <00:18:08.638>single <00:18:08.793>visit <00:18:08.949>that <00:18:09.105>someone,

343
00:18:12.155 --> 00:18:14.125
<00:18:12.155>someone <00:18:12.504>performs <00:18:12.855>on <00:18:13.205>this <00:18:13.555>page.

344
00:18:14.145 --> 00:18:17.405
<00:18:14.145>So <00:18:14.320>every <00:18:14.495>time <00:18:14.670>someone <00:18:14.845>opens <00:18:15.020>our <00:18:15.195>article <00:18:15.370>page, <00:18:15.545>we're,

345
00:18:17.465 --> 00:18:20.685
<00:18:17.465>we <00:18:17.620>wanna <00:18:17.776>track <00:18:17.931>that <00:18:18.087>and <00:18:18.242>record <00:18:18.398>that <00:18:18.553>in <00:18:18.709>our <00:18:18.865>database.

346
00:18:22.215 --> 00:18:26.875
<00:18:22.215>And <00:18:22.355>this <00:18:22.495>number <00:18:22.635>of <00:18:22.774>visits <00:18:22.915>or <00:18:23.054>views <00:18:23.195>can <00:18:23.334>grow <00:18:23.475>pretty <00:18:23.615>quickly.

347
00:18:27.335 --> 00:18:30.715
<00:18:27.335>So <00:18:27.510>we <00:18:27.685>may <00:18:27.860>have <00:18:28.035>tens <00:18:28.210>of <00:18:28.385>thousands <00:18:28.560>of <00:18:28.735>visits

348
00:18:30.975 --> 00:18:34.595
<00:18:30.975>or <00:18:31.130>even <00:18:31.286>millions <00:18:31.441>of <00:18:31.597>visits <00:18:31.752>to <00:18:31.908>a <00:18:32.063>single <00:18:32.219>article <00:18:32.375>page.

349
00:18:36.295 --> 00:18:38.795
<00:18:36.295>And <00:18:36.495>this <00:18:36.695>is <00:18:36.895>why <00:18:37.095>we're <00:18:37.295>saying <00:18:37.495>we <00:18:37.695>have

350
00:18:39.315 --> 00:18:40.755
<00:18:39.315>a <00:18:39.639>one <00:18:39.963>two <00:18:40.287>zillions <00:18:40.611>relationship.

351
00:18:41.265 --> 00:18:44.595
<00:18:41.265>Another <00:18:41.405>example <00:18:41.545>is <00:18:41.685>a <00:18:41.825>process <00:18:41.965>that <00:18:42.105>is <00:18:42.245>running <00:18:42.385>on <00:18:42.525>our <00:18:42.665>system

352
00:18:44.815 --> 00:18:47.035
<00:18:44.815>and <00:18:45.095>the <00:18:45.375>walk <00:18:45.655>messages <00:18:45.935>it <00:18:46.215>generates.

353
00:18:47.695 --> 00:18:49.795
<00:18:47.695>So <00:18:47.928>the <00:18:48.161>walk <00:18:48.395>messages, <00:18:48.628>we're <00:18:48.861>gathering <00:18:49.095>them,

354
00:18:49.805 --> 00:18:51.795
<00:18:49.805>we're <00:18:50.038>saving <00:18:50.271>them <00:18:50.505>in <00:18:50.738>our <00:18:50.971>system <00:18:51.205>so

355
00:18:51.795 --> 00:18:53.155
<00:18:51.795>that <00:18:52.101>if <00:18:52.407>the <00:18:52.713>process <00:18:53.019>crashes

356
00:18:53.155 --> 00:18:55.555
<00:18:53.155>or <00:18:53.388>causes <00:18:53.621>any <00:18:53.855>trouble, <00:18:54.088>we <00:18:54.321>can <00:18:54.555>look

357
00:18:55.555 --> 00:18:57.315
<00:18:55.555>through <00:18:55.835>these <00:18:56.115>walk <00:18:56.395>messages <00:18:56.675>later <00:18:56.955>on.

358
00:18:57.895 --> 00:19:00.235
<00:18:57.895>And <00:18:58.128>again, <00:18:58.361>it's <00:18:58.595>a <00:18:58.828>one <00:18:59.061>zi <00:18:59.295>relationship

359
00:19:00.585 --> 00:19:05.315
<00:19:00.585>because <00:19:00.760>we <00:19:00.935>may <00:19:01.110>have <00:19:01.285>tens <00:19:01.460>of <00:19:01.635>thousands <00:19:01.810>or <00:19:01.985>millions

360
00:19:05.335 --> 00:19:07.235
<00:19:05.335>or <00:19:05.685>even <00:19:06.035>more <00:19:06.385>walk <00:19:06.735>messages.

361
00:19:09.335 --> 00:19:11.395
<00:19:09.335>So <00:19:09.535>we <00:19:09.735>may <00:19:09.935>have <00:19:10.135>just <00:19:10.335>a <00:19:10.535>few <00:19:10.735>visits

362
00:19:12.215 --> 00:19:13.995
<00:19:12.215>or <00:19:12.448>we <00:19:12.681>may <00:19:12.915>have <00:19:13.148>millions <00:19:13.381>of <00:19:13.615>visits.

363
00:19:14.095 --> 00:19:17.315
<00:19:14.095>That's <00:19:14.270>why <00:19:14.445>we <00:19:14.620>have <00:19:14.795>a <00:19:14.970>possibly <00:19:15.145>very <00:19:15.320>large <00:19:15.495>chamber.

364
00:19:18.695 --> 00:19:20.075
<00:19:18.695>And <00:19:18.943>how <00:19:19.191>do <00:19:19.440>we <00:19:19.688>model <00:19:19.937>that?

365
00:19:20.345 --> 00:19:23.475
<00:19:20.345>Well, <00:19:20.520>I'm <00:19:20.695>not <00:19:20.870>gonna <00:19:21.045>spend <00:19:21.220>too <00:19:21.395>much <00:19:21.570>time <00:19:21.745>explaining,

366
00:19:23.655 --> 00:19:26.795
<00:19:23.655>but <00:19:23.782>uh, <00:19:23.909>if <00:19:24.036>you <00:19:24.164>think <00:19:24.291>about <00:19:24.418>it <00:19:24.545>later <00:19:24.673>on <00:19:24.800>a <00:19:24.927>little <00:19:25.055>bit

367
00:19:26.855 --> 00:19:29.555
<00:19:26.855>or <00:19:26.971>if <00:19:27.088>you <00:19:27.205>think <00:19:27.321>about <00:19:27.438>what <00:19:27.555>is <00:19:27.671>the <00:19:27.788>right <00:19:27.905>way <00:19:28.021>to <00:19:28.138>do <00:19:28.255>that,

368
00:19:30.545 --> 00:19:32.395
<00:19:30.545>it's, <00:19:30.895>it's <00:19:31.245>by <00:19:31.595>using <00:19:31.945>referencing

369
00:19:32.775 --> 00:19:35.835
<00:19:32.775>and <00:19:32.930>it's <00:19:33.086>also <00:19:33.241>by <00:19:33.397>using <00:19:33.552>referencing <00:19:33.708>on <00:19:33.863>the <00:19:34.019>many <00:19:34.175>side

370
00:19:35.905 --> 00:19:38.395
<00:19:35.905>because <00:19:36.185>this <00:19:36.465>is <00:19:36.745>the <00:19:37.024>only <00:19:37.305>situation,

371
00:19:38.575 --> 00:19:41.595
<00:19:38.575>the <00:19:38.775>only <00:19:38.975>option <00:19:39.175>when <00:19:39.375>we <00:19:39.575>don't <00:19:39.775>risk <00:19:39.975>exceeding

372
00:19:42.135 --> 00:19:43.315
<00:19:42.135>the <00:19:42.489>document <00:19:42.843>size <00:19:43.197>limit.

373
00:19:44.435 --> 00:19:47.175
<00:19:44.435>And <00:19:44.610>okay, <00:19:44.784>we <00:19:44.960>do <00:19:45.135>have <00:19:45.310>a <00:19:45.485>document <00:19:45.659>size <00:19:45.835>limit

374
00:19:47.315 --> 00:19:49.295
<00:19:47.315>and <00:19:47.548>when <00:19:47.781>would <00:19:48.015>be <00:19:48.248>that <00:19:48.481>16 <00:19:48.715>megabytes.

375
00:19:49.355 --> 00:19:51.615
<00:19:49.355>Uh, <00:19:49.555>in <00:19:49.755>some <00:19:49.955>other <00:19:50.155>databases <00:19:50.355>it's <00:19:50.555>even <00:19:50.755>lower

376
00:19:51.715 --> 00:19:53.255
<00:19:51.715>or <00:19:52.061>it <00:19:52.408>can <00:19:52.754>be <00:19:53.101>more.

377
00:19:53.315 --> 00:19:55.175
<00:19:53.315>But, <00:19:53.548>uh, <00:19:53.781>usually <00:19:54.015>we <00:19:54.248>don't <00:19:54.481>wanna <00:19:54.715>work

378
00:19:55.175 --> 00:19:57.095
<00:19:55.175>with <00:19:55.641>super <00:19:56.108>large <00:19:56.575>documents.

379
00:19:57.875 --> 00:20:01.015
<00:19:57.875>So <00:19:58.030>even <00:19:58.186>if <00:19:58.341>we <00:19:58.497>didn't <00:19:58.652>really <00:19:58.808>succeed <00:19:58.963>in <00:19:59.119>any <00:19:59.275>limits,

380
00:20:01.435 --> 00:20:06.305
<00:20:01.435>we <00:20:01.590>still <00:20:01.746>would <00:20:01.901>have <00:20:02.057>wanted <00:20:02.212>to <00:20:02.368>limit <00:20:02.523>the, <00:20:02.679>the <00:20:02.835>size

381
00:20:06.485 --> 00:20:08.825
<00:20:06.485>of <00:20:06.659>the <00:20:06.834>documents <00:20:07.010>that <00:20:07.185>we're <00:20:07.360>working <00:20:07.534>at, <00:20:07.709>uh, <00:20:07.885>with,

382
00:20:09.015 --> 00:20:10.465
<00:20:09.015>because <00:20:09.232>in <00:20:09.450>the <00:20:09.667>end <00:20:09.885>of <00:20:10.102>the <00:20:10.320>day,

383
00:20:10.465 --> 00:20:12.465
<00:20:10.465>we're <00:20:10.698>grabbing <00:20:10.931>these <00:20:11.165>documents <00:20:11.398>from <00:20:11.631>the <00:20:11.865>database,

384
00:20:12.475 --> 00:20:13.745
<00:20:12.475>we're <00:20:12.760>loading <00:20:13.046>them <00:20:13.332>in <00:20:13.618>memory

385
00:20:13.765 --> 00:20:15.265
<00:20:13.765>and <00:20:13.957>they <00:20:14.150>were <00:20:14.343>trying <00:20:14.536>to <00:20:14.729>work <00:20:14.922>with <00:20:15.115>them.

386
00:20:15.325 --> 00:20:19.105
<00:20:15.325>So <00:20:15.465>we <00:20:15.605>kind <00:20:15.745>of <00:20:15.885>don't <00:20:16.025>wanna <00:20:16.165>be <00:20:16.305>working <00:20:16.445>with <00:20:16.585>super <00:20:16.725>huge,

387
00:20:19.725 --> 00:20:21.385
<00:20:19.725>um, <00:20:21.125>documents.

388
00:20:22.845 --> 00:20:25.625
<00:20:22.845>So <00:20:23.045>to <00:20:23.245>summarize, <00:20:23.445>in <00:20:23.645>this <00:20:23.845>type <00:20:24.045>of <00:20:24.245>relationship

389
00:20:26.545 --> 00:20:28.425
<00:20:26.545>reference <00:20:26.720>on <00:20:26.895>the <00:20:27.070>many <00:20:27.245>side, <00:20:27.420>this <00:20:27.595>is <00:20:27.770>the <00:20:27.945>kind

390
00:20:28.425 --> 00:20:31.065
<00:20:28.425>of <00:20:28.625>the <00:20:28.825>right <00:20:29.024>way <00:20:29.225>to <00:20:29.425>model <00:20:29.625>this <00:20:29.825>relationship.

391
00:20:32.325 --> 00:20:34.985
<00:20:32.325>And <00:20:32.500>another <00:20:32.675>thing <00:20:32.850>that <00:20:33.025>we <00:20:33.200>should <00:20:33.375>be <00:20:33.550>careful <00:20:33.725>is

392
00:20:34.985 --> 00:20:38.505
<00:20:34.985>that <00:20:35.159>even <00:20:35.334>when <00:20:35.510>we're <00:20:35.685>working <00:20:35.860>in <00:20:36.034>our <00:20:36.209>application, <00:20:36.385>um,

393
00:20:38.975 --> 00:20:40.545
<00:20:38.975>when <00:20:39.324>we're <00:20:39.675>writing <00:20:40.024>application <00:20:40.375>code

394
00:20:40.545 --> 00:20:42.225
<00:20:40.545>and <00:20:40.825>working <00:20:41.105>with <00:20:41.385>the <00:20:41.665>zillions <00:20:41.945>collection,

395
00:20:42.245 --> 00:20:43.265
<00:20:42.245>we <00:20:42.474>should <00:20:42.704>be <00:20:42.933>super <00:20:43.163>careful

396
00:20:43.485 --> 00:20:47.815
<00:20:43.485>and <00:20:43.640>it's <00:20:43.796>a <00:20:43.951>common <00:20:44.107>suggestion <00:20:44.262>to <00:20:44.418>just <00:20:44.573>add <00:20:44.729>a <00:20:44.885>bunch

397
00:20:47.815 --> 00:20:50.735
<00:20:47.815>of <00:20:48.015>comments <00:20:48.215>when <00:20:48.415>you're <00:20:48.615>working <00:20:48.815>with <00:20:49.015>this <00:20:49.215>kind

398
00:20:50.735 --> 00:20:51.735
<00:20:50.735>of <00:20:51.635>relationship.

399
00:20:51.805 --> 00:20:56.305
<00:20:51.805>Just, <00:20:51.945>uh, <00:20:52.085>so <00:20:52.225>you <00:20:52.365>don't, <00:20:52.505>um, <00:20:52.645>you <00:20:52.785>don't <00:20:52.925>cause <00:20:53.065>any <00:20:53.205>trouble

400
00:20:56.605 --> 00:20:58.705
<00:20:56.605>to, <00:20:56.955>to <00:20:57.305>the <00:20:57.655>front <00:20:58.005>end

401
00:20:58.805 --> 00:21:01.545
<00:20:58.805>or <00:20:59.005>to <00:20:59.205>anywhere <00:20:59.405>you <00:20:59.605>wanna <00:20:59.805>move <00:21:00.005>this <00:21:00.205>data.

402
00:21:01.685 --> 00:21:03.505
<00:21:01.685>So <00:21:01.918>if <00:21:02.151>you're <00:21:02.385>querying <00:21:02.618>from <00:21:02.851>the <00:21:03.085>database

403
00:21:03.505 --> 00:21:07.105
<00:21:03.505>and <00:21:03.660>you <00:21:03.816>walls, <00:21:03.971>uh, <00:21:04.127>millions <00:21:04.282>of <00:21:04.438>elements <00:21:04.593>in <00:21:04.749>the <00:21:04.905>memory,

404
00:21:07.165 --> 00:21:09.145
<00:21:07.165>that's <00:21:07.320>gonna <00:21:07.476>be <00:21:07.631>an <00:21:07.787>issue <00:21:07.942>if <00:21:08.098>you <00:21:08.253>wanna <00:21:08.409>send <00:21:08.565>them

405
00:21:09.685 --> 00:21:11.585
<00:21:09.685>or <00:21:09.840>if <00:21:09.996>you <00:21:10.151>try <00:21:10.307>to <00:21:10.462>send <00:21:10.618>them <00:21:10.773>down <00:21:10.929>the <00:21:11.085>network

406
00:21:11.725 --> 00:21:14.425
<00:21:11.725>to <00:21:11.865>the <00:21:12.004>front <00:21:12.145>end, <00:21:12.284>it's, <00:21:12.425>it's <00:21:12.564>also <00:21:12.705>gonna <00:21:12.844>cause <00:21:12.985>an <00:21:13.125>issue.

407
00:21:14.485 --> 00:21:16.945
<00:21:14.485>So <00:21:14.685>just <00:21:14.885>be <00:21:15.084>careful <00:21:15.284>when <00:21:15.485>working <00:21:15.685>with <00:21:15.885>that.

408
00:21:19.435 --> 00:21:22.415
<00:21:19.435>And <00:21:19.575>this <00:21:19.715>is <00:21:19.855>how <00:21:19.995>referencing <00:21:20.135>condom <00:21:20.274>site <00:21:20.415>is <00:21:20.554>gonna <00:21:20.695>look <00:21:20.835>like

409
00:21:22.835 --> 00:21:25.735
<00:21:22.835>in <00:21:23.115>our <00:21:23.395>article <00:21:23.675>page <00:21:23.955>view <00:21:24.235>example.

410
00:21:26.875 --> 00:21:28.375
<00:21:26.875>So <00:21:27.145>we <00:21:27.415>have <00:21:27.685>an <00:21:27.955>article <00:21:28.225>ID

411
00:21:28.555 --> 00:21:30.815
<00:21:28.555>and <00:21:29.021>we <00:21:29.488>are <00:21:29.955>referring

412
00:21:30.955 --> 00:21:33.375
<00:21:30.955>to <00:21:31.155>this <00:21:31.355>article <00:21:31.554>from <00:21:31.754>every <00:21:31.955>single <00:21:32.155>page <00:21:32.355>view

413
00:21:33.475 --> 00:21:37.655
<00:21:33.475>or <00:21:33.615>page <00:21:33.754>visit, <00:21:33.895>um, <00:21:34.034>that <00:21:34.175>we <00:21:34.314>are <00:21:34.455>saving <00:21:34.594>in <00:21:34.735>the <00:21:34.875>database.

414
00:21:40.475 --> 00:21:42.645
<00:21:40.475>Alright, <00:21:40.824>we <00:21:41.175>covered <00:21:41.524>both <00:21:41.875>extremes.

415
00:21:42.865 --> 00:21:44.845
<00:21:42.865>We <00:21:43.040>know <00:21:43.215>that <00:21:43.390>with <00:21:43.565>one <00:21:43.740>to <00:21:43.915>few <00:21:44.090>we <00:21:44.265>need

416
00:21:44.845 --> 00:21:47.325
<00:21:44.845>to <00:21:45.000>embed <00:21:45.156>on <00:21:45.311>the <00:21:45.467>one <00:21:45.622>side <00:21:45.778>with <00:21:45.933>one <00:21:46.089>to <00:21:46.245>zillions.

417
00:21:47.325 --> 00:21:49.645
<00:21:47.325>We <00:21:47.500>need <00:21:47.675>to <00:21:47.850>use <00:21:48.025>referencing <00:21:48.200>on <00:21:48.375>the <00:21:48.550>many <00:21:48.725>side.

418
00:21:50.505 --> 00:21:52.165
<00:21:50.505>But <00:21:50.785>what <00:21:51.065>about <00:21:51.345>the <00:21:51.625>middle <00:21:51.905>case?

419
00:21:52.275 --> 00:21:54.765
<00:21:52.275>What <00:21:52.508>about <00:21:52.741>one <00:21:52.975>to <00:21:53.208>many <00:21:53.441>in <00:21:53.675>general?

420
00:21:56.245 --> 00:21:58.735
<00:21:56.245>Well, <00:21:56.478>I <00:21:56.711>don't <00:21:56.945>have <00:21:57.178>a <00:21:57.411>straightforward <00:21:57.645>recipe

421
00:21:59.195 --> 00:22:00.575
<00:21:59.195>for <00:21:59.609>solving <00:22:00.023>this <00:22:00.437>issue,

422
00:22:00.635 --> 00:22:03.895
<00:22:00.635>but <00:22:00.810>I <00:22:00.985>can <00:22:01.160>give <00:22:01.335>you <00:22:01.510>another <00:22:01.685>question <00:22:01.860>that, <00:22:02.035>uh,

423
00:22:03.895 --> 00:22:07.015
<00:22:03.895>is <00:22:04.022>gonna <00:22:04.149>lead <00:22:04.276>you <00:22:04.404>to <00:22:04.531>the <00:22:04.658>right, <00:22:04.785>uh, <00:22:04.913>to <00:22:05.040>the <00:22:05.167>right <00:22:05.295>model.

424
00:22:09.495 --> 00:22:12.555
<00:22:09.495>And <00:22:09.669>this <00:22:09.844>question <00:22:10.020>is, <00:22:10.195>when <00:22:10.370>you're <00:22:10.544>modeling <00:22:10.719>quantum <00:22:10.895>many,

425
00:22:13.015 --> 00:22:15.715
<00:22:13.015>are <00:22:13.215>you <00:22:13.415>dealing <00:22:13.615>with <00:22:13.815>two <00:22:14.015>separate <00:22:14.215>logical <00:22:14.415>units?

426
00:22:17.475 --> 00:22:19.855
<00:22:17.475>And <00:22:17.649>if <00:22:17.824>you're <00:22:18.000>dealing <00:22:18.175>with <00:22:18.350>two <00:22:18.524>separate <00:22:18.699>logical <00:22:18.875>units,

427
00:22:19.955 --> 00:22:22.455
<00:22:19.955>for <00:22:20.129>example, <00:22:20.304>you <00:22:20.480>have <00:22:20.655>a <00:22:20.830>book <00:22:21.004>and <00:22:21.179>it's <00:22:21.355>jars

428
00:22:22.455 --> 00:22:26.895
<00:22:22.455>and <00:22:22.582>the <00:22:22.709>jars <00:22:22.836>will <00:22:22.964>be <00:22:23.091>used <00:22:23.218>as, <00:22:23.345>uh, <00:22:23.473>something <00:22:23.600>on <00:22:23.727>their <00:22:23.855>own.

429
00:22:27.475 --> 00:22:30.575
<00:22:27.475>So <00:22:27.615>you <00:22:27.754>will <00:22:27.895>be, <00:22:28.034>uh, <00:22:28.175>displaying <00:22:28.314>the <00:22:28.455>jars <00:22:28.594>in <00:22:28.735>a <00:22:28.875>page

430
00:22:30.635 --> 00:22:34.215
<00:22:30.635>or <00:22:30.835>you <00:22:31.035>will <00:22:31.235>be, <00:22:31.435>uh, <00:22:31.635>searching <00:22:31.835>for <00:22:32.035>jars

431
00:22:34.715 --> 00:22:35.855
<00:22:34.715>or <00:22:35.057>something <00:22:35.399>like <00:22:35.741>that.

432
00:22:35.915 --> 00:22:39.655
<00:22:35.915>So <00:22:36.055>there, <00:22:36.195>there, <00:22:36.335>uh, <00:22:36.475>actually, <00:22:36.615>uh, <00:22:36.754>system <00:22:36.895>unit <00:22:37.034>on <00:22:37.175>their <00:22:37.315>own

433
00:22:40.005 --> 00:22:41.935
<00:22:40.005>that <00:22:40.205>are, <00:22:40.405>that <00:22:40.605>is <00:22:40.805>separate <00:22:41.005>from <00:22:41.205>the <00:22:41.405>books.

434
00:22:42.725 --> 00:22:45.295
<00:22:42.725>Then <00:22:42.958>you <00:22:43.191>should <00:22:43.425>use <00:22:43.658>two <00:22:43.891>different <00:22:44.125>collections.

435
00:22:45.555 --> 00:22:47.255
<00:22:45.555>One <00:22:45.835>for <00:22:46.115>books, <00:22:46.395>one <00:22:46.675>for <00:22:46.955>jars,

436
00:22:47.755 --> 00:22:50.495
<00:22:47.755>and <00:22:47.955>you <00:22:48.155>should <00:22:48.355>use <00:22:48.555>referencing <00:22:48.755>to <00:22:48.955>connect <00:22:49.155>them.

437
00:22:50.715 --> 00:22:53.095
<00:22:50.715>And <00:22:50.889>usually <00:22:51.064>we <00:22:51.240>use <00:22:51.415>referencing <00:22:51.590>on <00:22:51.764>the <00:22:51.939>menu <00:22:52.115>site.

438
00:22:54.355 --> 00:22:55.735
<00:22:54.355>But <00:22:54.603>the <00:22:54.851>important <00:22:55.100>part <00:22:55.348>here <00:22:55.597>is

439
00:22:55.735 --> 00:22:59.055
<00:22:55.735>that <00:22:55.890>you <00:22:56.046>should <00:22:56.201>split <00:22:56.357>the <00:22:56.512>system <00:22:56.668>units <00:22:56.823>into <00:22:56.979>the <00:22:57.135>two

440
00:22:59.055 --> 00:23:01.855
<00:22:59.055>different <00:22:59.255>collections <00:22:59.455>so <00:22:59.655>that <00:22:59.855>you <00:23:00.055>can <00:23:00.255>easily <00:23:00.455>work

441
00:23:01.855 --> 00:23:02.935
<00:23:01.855>with <00:23:02.341>them <00:23:02.827>separately.

442
00:23:04.905 --> 00:23:07.285
<00:23:04.905>And <00:23:05.080>if <00:23:05.254>you're <00:23:05.430>dealing <00:23:05.605>actually <00:23:05.780>with <00:23:05.955>just <00:23:06.129>one <00:23:06.305>single

443
00:23:07.795 --> 00:23:09.845
<00:23:07.795>logical <00:23:08.028>unit, <00:23:08.261>so <00:23:08.495>you <00:23:08.728>have <00:23:08.961>a <00:23:09.195>book

444
00:23:09.845 --> 00:23:11.925
<00:23:09.845>and <00:23:10.125>the <00:23:10.405>genres <00:23:10.685>is <00:23:10.965>actually <00:23:11.245>something

445
00:23:11.925 --> 00:23:14.205
<00:23:11.925>that <00:23:12.125>is <00:23:12.325>a <00:23:12.524>meta <00:23:12.725>information <00:23:12.925>about <00:23:13.125>the <00:23:13.325>book.

446
00:23:14.265 --> 00:23:15.405
<00:23:14.265>So <00:23:14.778>it's <00:23:15.291>something

447
00:23:15.405 --> 00:23:18.525
<00:23:15.405>that <00:23:15.532>is <00:23:15.659>never <00:23:15.786>gonna <00:23:15.914>be <00:23:16.041>used <00:23:16.168>out <00:23:16.295>the <00:23:16.423>context <00:23:16.550>of <00:23:16.677>the <00:23:16.805>book,

448
00:23:19.235 --> 00:23:22.285
<00:23:19.235>then <00:23:19.390>you <00:23:19.546>should <00:23:19.701>use <00:23:19.857>just <00:23:20.012>a <00:23:20.168>single <00:23:20.323>collection <00:23:20.479>of <00:23:20.635>books

449
00:23:22.825 --> 00:23:25.725
<00:23:22.825>and <00:23:22.980>you <00:23:23.136>should <00:23:23.291>embed <00:23:23.447>the <00:23:23.602>jars <00:23:23.758>in <00:23:23.913>the <00:23:24.069>book <00:23:24.225>document.

450
00:23:27.065 --> 00:23:28.285
<00:23:27.065>And <00:23:27.339>if <00:23:27.614>you're <00:23:27.888>not <00:23:28.163>sure,

451
00:23:28.695 --> 00:23:31.325
<00:23:28.695>maybe <00:23:28.895>you <00:23:29.095>should <00:23:29.294>split <00:23:29.495>this <00:23:29.695>into <00:23:29.895>different <00:23:30.095>collections

452
00:23:31.875 --> 00:23:33.405
<00:23:31.875>into <00:23:32.219>D <00:23:32.563>two <00:23:32.907>different <00:23:33.252>collections.

453
00:23:33.405 --> 00:23:34.845
<00:23:33.405>And <00:23:33.729>you <00:23:34.053>should <00:23:34.377>use <00:23:34.701>referencing

454
00:23:35.225 --> 00:23:37.285
<00:23:35.225>unless <00:23:35.574>you're <00:23:35.925>looking <00:23:36.274>for <00:23:36.625>simplicity

455
00:23:37.665 --> 00:23:42.285
<00:23:37.665>or <00:23:37.805>you're <00:23:37.945>sure <00:23:38.085>that <00:23:38.225>you're <00:23:38.365>working <00:23:38.504>with <00:23:38.645>just <00:23:38.784>a <00:23:38.925>small <00:23:39.065>number

456
00:23:42.785 --> 00:23:45.005
<00:23:42.785>of, <00:23:43.251>um, <00:23:43.718>of <00:23:44.185>data

457
00:23:45.425 --> 00:23:47.925
<00:23:45.425>or, <00:23:45.705>um, <00:23:45.985>a <00:23:46.264>small <00:23:46.544>cardinality <00:23:46.825>basically.

458
00:23:48.545 --> 00:23:51.245
<00:23:48.545>And <00:23:48.745>if <00:23:48.945>you're <00:23:49.145>not <00:23:49.345>afraid <00:23:49.545>to <00:23:49.745>migrate <00:23:49.945>later,

459
00:23:51.245 --> 00:23:53.805
<00:23:51.245>because <00:23:51.419>if <00:23:51.594>you <00:23:51.770>embed <00:23:51.945>everything <00:23:52.120>in <00:23:52.294>a <00:23:52.469>single <00:23:52.645>document

460
00:23:53.945 --> 00:23:58.045
<00:23:53.945>and <00:23:54.085>it <00:23:54.225>turns <00:23:54.365>out <00:23:54.504>that <00:23:54.645>actually <00:23:54.784>you <00:23:54.925>are <00:23:55.064>gonna <00:23:55.205>be <00:23:55.345>needing

461
00:23:58.045 --> 00:24:01.125
<00:23:58.045>to <00:23:58.200>work <00:23:58.356>with <00:23:58.511>this <00:23:58.667>embedded <00:23:58.822>information, <00:23:58.978>uh, <00:23:59.133>as <00:23:59.289>its <00:23:59.445>own,

462
00:24:01.825 --> 00:24:05.805
<00:24:01.825>as <00:24:01.980>its <00:24:02.136>own <00:24:02.291>separate <00:24:02.447>logical <00:24:02.602>unit, <00:24:02.758>then <00:24:02.913>you <00:24:03.069>might <00:24:03.225>have

463
00:24:05.805 --> 00:24:09.365
<00:24:05.805>to <00:24:06.038>split <00:24:06.271>this <00:24:06.505>into <00:24:06.738>the <00:24:06.971>different <00:24:07.205>collections.

464
00:24:09.945 --> 00:24:12.445
<00:24:09.945>So <00:24:10.178>you'll <00:24:10.411>have <00:24:10.645>to <00:24:10.878>perform <00:24:11.111>a <00:24:11.345>migration.

465
00:24:14.185 --> 00:24:15.925
<00:24:14.185>So <00:24:14.385>here <00:24:14.585>you <00:24:14.784>have <00:24:14.985>kind <00:24:15.185>of <00:24:15.385>a <00:24:15.585>recipe

466
00:24:16.305 --> 00:24:17.645
<00:24:16.305>for <00:24:16.707>all <00:24:17.109>these <00:24:17.511>relationships.

467
00:24:19.355 --> 00:24:22.175
<00:24:19.355>And <00:24:19.588>let's <00:24:19.821>see, <00:24:20.055>a <00:24:20.288>real <00:24:20.521>world <00:24:20.755>example.

468
00:24:22.395 --> 00:24:25.135
<00:24:22.395>And <00:24:22.522>just <00:24:22.649>to <00:24:22.776>note <00:24:22.904>here, <00:24:23.031>I'm <00:24:23.158>not <00:24:23.285>gonna <00:24:23.413>be <00:24:23.540>covering <00:24:23.667>many <00:24:23.795>too

469
00:24:25.135 --> 00:24:27.575
<00:24:25.135>many, <00:24:25.290>but <00:24:25.446>I'm <00:24:25.601>gonna <00:24:25.757>give <00:24:25.912>you <00:24:26.068>resources <00:24:26.223>at <00:24:26.379>the <00:24:26.535>end

470
00:24:27.575 --> 00:24:30.575
<00:24:27.575>that <00:24:27.730>are <00:24:27.886>gonna, <00:24:28.041>uh, <00:24:28.197>tell <00:24:28.352>you <00:24:28.508>how <00:24:28.663>to <00:24:28.819>model <00:24:28.975>many,

471
00:24:30.575 --> 00:24:31.935
<00:24:30.575>many <00:24:30.983>relationships <00:24:31.391>as <00:24:31.799>well.

472
00:24:32.595 --> 00:24:35.455
<00:24:32.595>But <00:24:32.735>it's, <00:24:32.875>it's <00:24:33.015>actually <00:24:33.155>repeating <00:24:33.295>a <00:24:33.435>lot <00:24:33.575>of <00:24:33.715>the <00:24:33.855>same <00:24:33.995>stuff

473
00:24:35.455 --> 00:24:37.695
<00:24:35.455>that <00:24:35.595>we <00:24:35.735>went <00:24:35.875>through <00:24:36.014>and <00:24:36.155>you're <00:24:36.294>gonna <00:24:36.435>be <00:24:36.574>using <00:24:36.715>the <00:24:36.855>same

474
00:24:37.695 --> 00:24:40.175
<00:24:37.695>mental <00:24:38.044>models <00:24:38.395>when <00:24:38.745>modeling <00:24:39.095>many,

475
00:24:40.175 --> 00:24:41.535
<00:24:40.175>many <00:24:40.583>relationships <00:24:40.991>as <00:24:41.399>well.

476
00:24:41.875 --> 00:24:42.975
<00:24:41.875>So <00:24:42.122>we're <00:24:42.370>gonna <00:24:42.617>skip <00:24:42.865>that

477
00:24:43.235 --> 00:24:47.895
<00:24:43.235>and <00:24:43.375>we're <00:24:43.514>gonna <00:24:43.655>see <00:24:43.794>a <00:24:43.935>real <00:24:44.074>world <00:24:44.215>example <00:24:44.354>for, <00:24:44.495>um, <00:24:44.635>kind

478
00:24:47.895 --> 00:24:50.815
<00:24:47.895>of <00:24:48.022>a <00:24:48.149>one <00:24:48.276>to <00:24:48.404>many, <00:24:48.531>or <00:24:48.658>maybe <00:24:48.785>it's, <00:24:48.913>it's <00:24:49.040>actually <00:24:49.167>a <00:24:49.295>minute

479
00:24:50.815 --> 00:24:54.055
<00:24:50.815>to <00:24:51.015>many <00:24:51.215>relationship, <00:24:51.415>but <00:24:51.615>it's, <00:24:51.815>it's <00:24:52.015>super <00:24:52.215>simple.

480
00:24:54.225 --> 00:24:55.495
<00:24:54.225>Let's <00:24:54.453>see <00:24:54.682>what <00:24:54.910>we're <00:24:55.139>working <00:24:55.368>with.

481
00:24:57.315 --> 00:25:00.695
<00:24:57.315>And <00:24:57.455>I <00:24:57.595>said <00:24:57.735>it's <00:24:57.875>simple, <00:24:58.015>but <00:24:58.155>we <00:24:58.295>have <00:24:58.435>this <00:24:58.575>load <00:24:58.715>slide.

482
00:25:00.915 --> 00:25:03.135
<00:25:00.915>So <00:25:01.090>let's <00:25:01.264>walk <00:25:01.440>through <00:25:01.615>it <00:25:01.790>from <00:25:01.965>left <00:25:02.139>to <00:25:02.315>right.

483
00:25:03.875 --> 00:25:06.735
<00:25:03.875>We <00:25:04.050>have <00:25:04.225>this <00:25:04.400>system <00:25:04.575>where <00:25:04.750>we <00:25:04.925>have <00:25:05.100>meeting <00:25:05.275>rooms

484
00:25:07.555 --> 00:25:10.975
<00:25:07.555>and <00:25:07.710>every <00:25:07.866>time <00:25:08.021>someone <00:25:08.177>a <00:25:08.332>user <00:25:08.488>books <00:25:08.643>a <00:25:08.799>meeting <00:25:08.955>room,

485
00:25:11.195 --> 00:25:13.215
<00:25:11.195>we <00:25:11.475>create <00:25:11.754>a <00:25:12.034>new <00:25:12.314>booking <00:25:12.595>document

486
00:25:13.315 --> 00:25:16.535
<00:25:13.315>and <00:25:13.455>we <00:25:13.595>store <00:25:13.735>this <00:25:13.875>as <00:25:14.015>a <00:25:14.155>separate <00:25:14.295>entity <00:25:14.435>in <00:25:14.575>our <00:25:14.715>system.

487
00:25:18.515 --> 00:25:20.735
<00:25:18.515>And <00:25:18.690>here, <00:25:18.865>as <00:25:19.040>you <00:25:19.215>can <00:25:19.390>see, <00:25:19.565>we're <00:25:19.740>using <00:25:19.915>referencing

488
00:25:20.735 --> 00:25:23.055
<00:25:20.735>because <00:25:20.935>we <00:25:21.135>have <00:25:21.334>ID <00:25:21.534>for <00:25:21.735>our <00:25:21.935>meeting <00:25:22.135>rooms

489
00:25:23.315 --> 00:25:26.015
<00:25:23.315>and <00:25:23.548>we <00:25:23.781>have <00:25:24.015>ID <00:25:24.248>for <00:25:24.481>our <00:25:24.715>users

490
00:25:26.475 --> 00:25:29.335
<00:25:26.475>and <00:25:26.675>inside <00:25:26.875>the <00:25:27.074>booking <00:25:27.274>documents, <00:25:27.475>we <00:25:27.675>are <00:25:27.875>referring

491
00:25:29.355 --> 00:25:31.895
<00:25:29.355>to <00:25:29.555>these <00:25:29.755>rooms <00:25:29.955>and <00:25:30.155>users <00:25:30.355>by <00:25:30.555>their <00:25:30.755>IDs.

492
00:25:34.065 --> 00:25:37.325
<00:25:34.065>And <00:25:34.265>let's <00:25:34.465>say <00:25:34.665>that <00:25:34.865>a <00:25:35.065>very <00:25:35.265>critical <00:25:35.465>query

493
00:25:37.425 --> 00:25:41.285
<00:25:37.425>for <00:25:37.600>our <00:25:37.774>system <00:25:37.950>is <00:25:38.125>listing <00:25:38.300>bookings <00:25:38.475>for <00:25:38.649>specific <00:25:38.825>dates

494
00:25:41.355 --> 00:25:44.285
<00:25:41.355>because <00:25:41.555>we <00:25:41.755>might <00:25:41.955>be <00:25:42.155>building <00:25:42.355>a <00:25:42.555>calendar <00:25:42.755>app

495
00:25:44.505 --> 00:25:49.485
<00:25:44.505>or, <00:25:44.705>um, <00:25:44.905>displaying <00:25:45.105>bookings <00:25:45.305>for <00:25:45.505>a <00:25:45.705>room, <00:25:45.905>um,

496
00:25:50.655 --> 00:25:52.355
<00:25:50.655>on <00:25:50.888>a <00:25:51.121>tablet <00:25:51.355>or <00:25:51.588>anything <00:25:51.821>like <00:25:52.055>that.

497
00:25:52.695 --> 00:25:55.355
<00:25:52.695>Anyway, <00:25:52.928>we <00:25:53.161>have <00:25:53.395>realized <00:25:53.628>that <00:25:53.861>listing <00:25:54.095>bookings

498
00:25:55.355 --> 00:25:57.955
<00:25:55.355>for <00:25:55.510>a <00:25:55.666>specific <00:25:55.821>date <00:25:55.977>is <00:25:56.132>a <00:25:56.288>very, <00:25:56.443>very <00:25:56.599>important <00:25:56.755>query

499
00:25:58.025 --> 00:25:59.515
<00:25:58.025>that <00:25:58.293>we <00:25:58.561>have <00:25:58.829>in <00:25:59.097>our <00:25:59.366>system.

500
00:26:01.355 --> 00:26:05.135
<00:26:01.355>So <00:26:01.530>how <00:26:01.705>do <00:26:01.880>we <00:26:02.055>accomplish <00:26:02.230>this? <00:26:02.405>Accomplish <00:26:02.580>this <00:26:02.755>query.

501
00:26:05.555 --> 00:26:09.175
<00:26:05.555>We <00:26:05.730>send, <00:26:05.905>um, <00:26:06.080>a <00:26:06.255>query <00:26:06.430>to <00:26:06.605>the <00:26:06.780>database <00:26:06.955>first

502
00:26:09.315 --> 00:26:12.615
<00:26:09.315>to <00:26:09.470>get <00:26:09.626>all <00:26:09.781>the <00:26:09.937>bookings <00:26:10.092>for <00:26:10.248>the <00:26:10.403>date <00:26:10.559>November <00:26:10.715>11th.

503
00:26:13.525 --> 00:26:14.815
<00:26:13.525>Then <00:26:13.815>because <00:26:14.105>we <00:26:14.395>need <00:26:14.686>to

504
00:26:15.365 --> 00:26:18.375
<00:26:15.365>display <00:26:15.565>some <00:26:15.765>more <00:26:15.965>information <00:26:16.165>about <00:26:16.365>the <00:26:16.565>meeting <00:26:16.765>room,

505
00:26:19.155 --> 00:26:21.255
<00:26:19.155>its <00:26:19.355>name <00:26:19.555>and <00:26:19.754>some <00:26:19.955>more <00:26:20.155>information <00:26:20.355>about <00:26:20.555>the

506
00:26:21.255 --> 00:26:22.975
<00:26:21.255>user, <00:26:21.721>also <00:26:22.188>their <00:26:22.655>name.

507
00:26:23.635 --> 00:26:27.295
<00:26:23.635>We <00:26:23.835>have <00:26:24.035>to <00:26:24.235>perform <00:26:24.435>a <00:26:24.635>separate <00:26:24.835>operation, <00:26:25.035>uh,

508
00:26:27.385 --> 00:26:30.295
<00:26:27.385>which <00:26:27.540>is <00:26:27.696>finding <00:26:27.851>the <00:26:28.007>room <00:26:28.162>from <00:26:28.318>the <00:26:28.473>list <00:26:28.629>of <00:26:28.785>rooms

509
00:26:30.475 --> 00:26:31.775
<00:26:30.475>and <00:26:30.669>grabbing <00:26:30.865>the <00:26:31.060>name <00:26:31.255>that <00:26:31.450>we <00:26:31.645>need.

510
00:26:31.875 --> 00:26:33.375
<00:26:31.875>We <00:26:32.043>have <00:26:32.212>to <00:26:32.381>do <00:26:32.550>the <00:26:32.718>same <00:26:32.887>for <00:26:33.056>the <00:26:33.225>user.

511
00:26:33.995 --> 00:26:35.975
<00:26:33.995>And <00:26:34.195>then <00:26:34.395>we <00:26:34.594>have <00:26:34.794>to <00:26:34.995>repeat <00:26:35.195>that <00:26:35.395>process

512
00:26:36.115 --> 00:26:38.055
<00:26:36.115>for <00:26:36.348>every <00:26:36.581>single <00:26:36.815>booking <00:26:37.048>that <00:26:37.281>we <00:26:37.515>have.

513
00:26:40.705 --> 00:26:43.485
<00:26:40.705>And <00:26:40.860>here <00:26:41.016>we're <00:26:41.171>using <00:26:41.327>one <00:26:41.482>query <00:26:41.638>to <00:26:41.793>get <00:26:41.949>the <00:26:42.105>bookings

514
00:26:43.505 --> 00:26:46.005
<00:26:43.505>and <00:26:43.705>to <00:26:43.905>our <00:26:44.105>lookups, <00:26:44.305>uh, <00:26:44.505>in <00:26:44.705>mon <00:26:44.905>db.

515
00:26:46.005 --> 00:26:49.005
<00:26:46.005>Or <00:26:46.132>you <00:26:46.259>can <00:26:46.386>think <00:26:46.514>about <00:26:46.641>it <00:26:46.768>as <00:26:46.895>two <00:26:47.023>separate <00:26:47.150>queries <00:26:47.277>that <00:26:47.405>are

516
00:26:49.925 --> 00:26:51.685
<00:26:49.925>additionally <00:26:50.205>added <00:26:50.485>to <00:26:50.764>our <00:26:51.044>one <00:26:51.325>query.

517
00:26:52.985 --> 00:26:54.885
<00:26:52.985>And <00:26:53.218>when <00:26:53.451>we're <00:26:53.685>using <00:26:53.918>this <00:26:54.151>data <00:26:54.385>model,

518
00:26:54.905 --> 00:26:56.125
<00:26:54.905>we <00:26:55.179>don't <00:26:55.454>have <00:26:55.728>any <00:26:56.003>duplication.

519
00:26:56.185 --> 00:26:57.525
<00:26:56.185>The, <00:26:56.486>so <00:26:56.788>that's, <00:26:57.089>that's <00:26:57.391>cool.

520
00:26:57.985 --> 00:27:00.605
<00:26:57.985>We <00:26:58.218>also <00:26:58.451>have <00:26:58.685>very <00:26:58.918>small <00:26:59.151>documents, <00:26:59.385>again,

521
00:27:00.605 --> 00:27:02.005
<00:27:00.605>because <00:27:01.025>we're <00:27:01.445>using <00:27:01.865>referencing,

522
00:27:02.145 --> 00:27:05.245
<00:27:02.145>but <00:27:02.285>the <00:27:02.425>disadvantages <00:27:02.565>that <00:27:02.705>we <00:27:02.845>need <00:27:02.985>to <00:27:03.125>use <00:27:03.264>to <00:27:03.405>our <00:27:03.545>workups,

523
00:27:05.775 --> 00:27:07.685
<00:27:05.775>which <00:27:06.125>can <00:27:06.475>slow <00:27:06.825>down <00:27:07.175>performance.

524
00:27:07.905 --> 00:27:10.325
<00:27:07.905>And <00:27:08.105>if <00:27:08.305>we <00:27:08.504>are <00:27:08.705>performing <00:27:08.905>this <00:27:09.105>operation <00:27:09.305>many,

525
00:27:10.325 --> 00:27:14.485
<00:27:10.325>many <00:27:10.558>times <00:27:10.791>per <00:27:11.025>millisecond, <00:27:11.258>uh, <00:27:11.491>we <00:27:11.725>have

526
00:27:14.485 --> 00:27:16.045
<00:27:14.485>to <00:27:14.718>find <00:27:14.951>a <00:27:15.185>way <00:27:15.418>to <00:27:15.651>optimize <00:27:15.885>it.

527
00:27:17.415 --> 00:27:20.385
<00:27:17.415>It's <00:27:17.542>beyond <00:27:17.669>the <00:27:17.796>scope <00:27:17.924>of <00:27:18.051>this <00:27:18.178>talk <00:27:18.305>to <00:27:18.433>talk <00:27:18.560>about <00:27:18.687>how <00:27:18.815>we

528
00:27:21.065 --> 00:27:22.505
<00:27:21.065>identify <00:27:21.497>such <00:27:21.929>critical <00:27:22.361>queries.

529
00:27:22.525 --> 00:27:26.905
<00:27:22.525>But <00:27:22.641>there <00:27:22.758>are <00:27:22.875>tons <00:27:22.991>of <00:27:23.108>tools <00:27:23.225>out <00:27:23.341>there <00:27:23.458>that <00:27:23.575>can <00:27:23.691>show <00:27:23.808>you, <00:27:23.925>um,

530
00:27:27.315 --> 00:27:29.865
<00:27:27.315>which <00:27:27.490>queries <00:27:27.665>are <00:27:27.840>more <00:27:28.015>often <00:27:28.190>used <00:27:28.365>or <00:27:28.540>in <00:27:28.715>can

531
00:27:29.965 --> 00:27:32.945
<00:27:29.965>or <00:27:30.139>are <00:27:30.314>problematic <00:27:30.490>or <00:27:30.665>are <00:27:30.840>slowing <00:27:31.014>down <00:27:31.189>your <00:27:31.365>system.

532
00:27:33.965 --> 00:27:37.565
<00:27:33.965>So <00:27:34.198>how <00:27:34.431>do <00:27:34.665>we <00:27:34.898>optimize <00:27:35.131>this <00:27:35.365>listing

533
00:27:37.705 --> 00:27:39.245
<00:27:37.705>of <00:27:38.167>bookings <00:27:38.629>per <00:27:39.091>date?

534
00:27:39.715 --> 00:27:42.405
<00:27:39.715>Well, <00:27:39.889>you <00:27:40.064>may <00:27:40.240>say, <00:27:40.415>okay, <00:27:40.590>we <00:27:40.764>can <00:27:40.939>use <00:27:41.115>embedding,

535
00:27:42.425 --> 00:27:43.565
<00:27:42.425>we <00:27:42.767>know <00:27:43.109>about <00:27:43.451>embedding,

536
00:27:43.585 --> 00:27:45.685
<00:27:43.585>so <00:27:43.760>we <00:27:43.935>can <00:27:44.110>just <00:27:44.285>swap <00:27:44.460>out <00:27:44.635>all <00:27:44.810>the <00:27:44.985>ideas

537
00:27:45.745 --> 00:27:47.845
<00:27:45.745>and <00:27:45.945>put <00:27:46.145>all <00:27:46.344>the <00:27:46.544>information <00:27:46.745>about <00:27:46.945>our <00:27:47.145>rooms

538
00:27:47.865 --> 00:27:50.645
<00:27:47.865>and <00:27:48.098>our <00:27:48.331>users <00:27:48.565>inside <00:27:48.798>the <00:27:49.031>booking <00:27:49.265>documents.

539
00:27:51.385 --> 00:27:52.565
<00:27:51.385>And <00:27:51.650>this <00:27:51.916>is <00:27:52.181>super <00:27:52.447>nice

540
00:27:52.565 --> 00:27:54.445
<00:27:52.565>because <00:27:52.798>we're <00:27:53.031>performing <00:27:53.265>just <00:27:53.498>a <00:27:53.731>single <00:27:53.965>query,

541
00:27:55.185 --> 00:27:57.845
<00:27:55.185>but <00:27:55.360>it's <00:27:55.534>gonna <00:27:55.710>lead <00:27:55.885>us <00:27:56.060>to <00:27:56.235>pretty <00:27:56.409>large <00:27:56.585>documents

542
00:27:57.985 --> 00:28:00.525
<00:27:57.985>as <00:27:58.185>you <00:27:58.385>can <00:27:58.584>obviously <00:27:58.784>see <00:27:58.985>on <00:27:59.185>the <00:27:59.385>slide.

543
00:28:01.305 --> 00:28:04.365
<00:28:01.305>And <00:28:01.480>it's <00:28:01.655>also <00:28:01.830>gonna <00:28:02.005>lead <00:28:02.180>us <00:28:02.355>to <00:28:02.530>having <00:28:02.705>lots

544
00:28:04.365 --> 00:28:05.445
<00:28:04.365>of <00:28:04.851>data <00:28:05.337>duplication

545
00:28:05.955 --> 00:28:08.485
<00:28:05.955>because <00:28:06.155>for <00:28:06.355>every <00:28:06.554>single <00:28:06.754>booking <00:28:06.955>that <00:28:07.155>we're <00:28:07.355>making,

546
00:28:08.655 --> 00:28:10.845
<00:28:08.655>we're <00:28:08.830>gonna <00:28:09.004>save <00:28:09.180>the <00:28:09.355>name, <00:28:09.530>the <00:28:09.705>capacity, <00:28:09.879>the <00:28:10.055>floor,

547
00:28:10.865 --> 00:28:12.205
<00:28:10.865>and <00:28:11.106>the <00:28:11.347>setup <00:28:11.588>for <00:28:11.829>our <00:28:12.071>room

548
00:28:12.585 --> 00:28:14.565
<00:28:12.585>and <00:28:12.818>the <00:28:13.051>username, <00:28:13.285>the <00:28:13.518>name, <00:28:13.751>the <00:28:13.985>addresses,

549
00:28:14.565 --> 00:28:16.485
<00:28:14.565>and <00:28:14.845>the <00:28:15.125>context <00:28:15.405>for <00:28:15.685>the <00:28:15.965>user.

550
00:28:16.985 --> 00:28:19.165
<00:28:16.985>So <00:28:17.218>we're <00:28:17.451>gonna <00:28:17.685>have <00:28:17.918>that <00:28:18.151>information <00:28:18.385>duplicated

551
00:28:19.165 --> 00:28:20.445
<00:28:19.165>across <00:28:19.741>different <00:28:20.317>documents.

552
00:28:22.305 --> 00:28:25.525
<00:28:22.305>And <00:28:22.445>what's <00:28:22.585>more <00:28:22.725>important <00:28:22.865>is <00:28:23.005>that <00:28:23.145>we <00:28:23.285>are <00:28:23.425>gonna <00:28:23.565>have <00:28:23.705>tons

553
00:28:25.545 --> 00:28:26.765
<00:28:25.545>of <00:28:26.094>unnecessary <00:28:26.643>data.

554
00:28:26.945 --> 00:28:30.565
<00:28:26.945>So <00:28:27.085>we <00:28:27.225>don't <00:28:27.365>need <00:28:27.504>information <00:28:27.645>about <00:28:27.784>the <00:28:27.925>setup <00:28:28.064>of <00:28:28.205>the <00:28:28.345>room,

555
00:28:31.305 --> 00:28:33.165
<00:28:31.305>uh, <00:28:31.655>in <00:28:32.005>our <00:28:32.355>booking <00:28:32.705>document

556
00:28:33.165 --> 00:28:36.085
<00:28:33.165>because <00:28:33.320>we <00:28:33.476>only <00:28:33.631>wanna <00:28:33.787>display <00:28:33.942>the <00:28:34.098>name <00:28:34.253>of <00:28:34.409>the <00:28:34.565>room

557
00:28:36.265 --> 00:28:38.845
<00:28:36.265>and <00:28:36.545>not <00:28:36.825>everything <00:28:37.105>about <00:28:37.385>this <00:28:37.665>room.

558
00:28:39.425 --> 00:28:43.365
<00:28:39.425>And <00:28:39.541>it's <00:28:39.658>similar <00:28:39.774>for <00:28:39.891>users <00:28:40.008>as <00:28:40.125>well. <00:28:40.241>So <00:28:40.358>how <00:28:40.475>do <00:28:40.591>we <00:28:40.708>solve <00:28:40.825>that?

559
00:28:44.755 --> 00:28:48.455
<00:28:44.755>And <00:28:44.930>the <00:28:45.105>answer <00:28:45.280>is <00:28:45.455>that <00:28:45.630>we <00:28:45.805>can <00:28:45.980>combine, <00:28:46.155>embed,

560
00:28:48.515 --> 00:28:52.895
<00:28:48.515>and <00:28:48.715>referencing <00:28:48.915>by <00:28:49.115>applying <00:28:49.315>the <00:28:49.515>extended <00:28:49.715>reference <00:28:49.915>pattern,

561
00:28:53.785 --> 00:28:58.255
<00:28:53.785>which <00:28:53.940>is <00:28:54.096>just <00:28:54.251>a <00:28:54.407>fancy <00:28:54.562>name <00:28:54.718>for <00:28:54.873>putting <00:28:55.029>the <00:28:55.185>ID

562
00:28:58.555 --> 00:28:59.855
<00:28:58.555>for <00:28:58.789>the <00:28:59.023>thing <00:28:59.257>that <00:28:59.491>we <00:28:59.725>need,

563
00:28:59.995 --> 00:29:02.055
<00:28:59.995>and <00:29:00.274>also <00:29:00.554>putting <00:29:00.834>some <00:29:01.114>additional <00:29:01.395>information,

564
00:29:02.105 --> 00:29:05.015
<00:29:02.105>which <00:29:02.338>is <00:29:02.571>the <00:29:02.805>minimum <00:29:03.038>minimal <00:29:03.271>amount <00:29:03.505>inform

565
00:29:05.035 --> 00:29:06.615
<00:29:05.035>of <00:29:05.385>information <00:29:05.735>that <00:29:06.085>we <00:29:06.435>need.

566
00:29:07.075 --> 00:29:09.695
<00:29:07.075>And <00:29:07.191>in <00:29:07.308>this <00:29:07.425>case, <00:29:07.541>this <00:29:07.658>means <00:29:07.775>that <00:29:07.891>we <00:29:08.008>are <00:29:08.125>gonna <00:29:08.241>put <00:29:08.358>the <00:29:08.475>name,

567
00:29:10.515 --> 00:29:13.455
<00:29:10.515>uh, <00:29:10.655>for <00:29:10.795>the <00:29:10.935>room <00:29:11.075>and <00:29:11.215>the <00:29:11.355>name <00:29:11.495>for <00:29:11.635>the <00:29:11.775>user <00:29:11.915>together

568
00:29:13.485 --> 00:29:16.015
<00:29:13.485>with <00:29:13.718>their <00:29:13.951>IDs <00:29:14.185>inside <00:29:14.418>our <00:29:14.651>booking <00:29:14.885>documents.

569
00:29:18.745 --> 00:29:20.245
<00:29:18.745>So <00:29:19.014>when <00:29:19.284>we're <00:29:19.554>perform <00:29:19.824>this <00:29:20.094>query,

570
00:29:20.475 --> 00:29:22.325
<00:29:20.475>when <00:29:20.754>using <00:29:21.034>the <00:29:21.314>extended <00:29:21.594>reference <00:29:21.875>pattern,

571
00:29:22.535 --> 00:29:24.405
<00:29:22.535>we're <00:29:22.768>gonna <00:29:23.001>perform <00:29:23.235>just <00:29:23.468>a <00:29:23.701>single <00:29:23.935>query

572
00:29:24.545 --> 00:29:26.165
<00:29:24.545>and <00:29:24.778>we're <00:29:25.011>gonna <00:29:25.245>have <00:29:25.478>all <00:29:25.711>the <00:29:25.945>information

573
00:29:26.165 --> 00:29:28.045
<00:29:26.165>because <00:29:26.445>that's <00:29:26.725>stored <00:29:27.004>in <00:29:27.284>one <00:29:27.565>document,

574
00:29:28.655 --> 00:29:30.765
<00:29:28.655>we're <00:29:28.935>gonna <00:29:29.215>have <00:29:29.495>pretty <00:29:29.774>small <00:29:30.055>documents

575
00:29:30.765 --> 00:29:33.325
<00:29:30.765>because <00:29:30.920>we're <00:29:31.076>not <00:29:31.231>putting <00:29:31.387>all <00:29:31.542>the <00:29:31.698>information <00:29:31.853>about <00:29:32.009>the <00:29:32.165>room

576
00:29:33.625 --> 00:29:35.045
<00:29:33.625>inside <00:29:34.051>the <00:29:34.477>booking <00:29:34.903>document,

577
00:29:35.945 --> 00:29:40.145
<00:29:35.945>and <00:29:36.100>we <00:29:36.256>won't <00:29:36.411>have <00:29:36.567>unnecessary <00:29:36.722>data <00:29:36.878>for <00:29:37.033>the <00:29:37.189>same <00:29:37.345>reason,

578
00:29:41.545 --> 00:29:44.085
<00:29:41.545>but <00:29:41.745>we <00:29:41.945>still <00:29:42.145>may <00:29:42.345>have <00:29:42.545>some <00:29:42.745>data <00:29:42.945>duplication.

579
00:29:44.425 --> 00:29:45.805
<00:29:44.425>So <00:29:44.632>how <00:29:44.839>do <00:29:45.046>we <00:29:45.253>deal <00:29:45.460>with <00:29:45.667>it?

580
00:29:46.075 --> 00:29:50.305
<00:29:46.075>Well, <00:29:46.308>the <00:29:46.541>short <00:29:46.775>answer <00:29:47.008>is, <00:29:47.241>uh, <00:29:47.475>don't,

581
00:29:50.955 --> 00:29:52.425
<00:29:50.955>don't <00:29:51.219>be <00:29:51.484>afraid <00:29:51.748>to <00:29:52.013>duplicate <00:29:52.278>data.

582
00:29:52.525 --> 00:29:55.385
<00:29:52.525>As <00:29:52.700>you <00:29:52.875>can <00:29:53.050>see, <00:29:53.225>this <00:29:53.400>is <00:29:53.575>really <00:29:53.750>the <00:29:53.925>more,

583
00:29:55.925 --> 00:29:57.705
<00:29:55.925>the <00:29:56.391>better <00:29:56.858>approach, <00:29:57.325>um,

584
00:29:58.975 --> 00:30:01.385
<00:29:58.975>here <00:29:59.254>solving <00:29:59.534>in <00:29:59.814>solving <00:30:00.094>this <00:30:00.375>problem.

585
00:30:01.845 --> 00:30:03.665
<00:30:01.845>You <00:30:02.078>can <00:30:02.311>use <00:30:02.545>the <00:30:02.778>excellence <00:30:03.011>reference <00:30:03.245>pattern

586
00:30:04.325 --> 00:30:08.625
<00:30:04.325>and <00:30:04.452>you, <00:30:04.579>this <00:30:04.706>will <00:30:04.834>lead <00:30:04.961>it <00:30:05.088>to <00:30:05.215>a, <00:30:05.343>a <00:30:05.470>more <00:30:05.597>optimized <00:30:05.725>system.

587
00:30:08.895 --> 00:30:11.345
<00:30:08.895>It's <00:30:09.070>gonna, <00:30:09.245>you're <00:30:09.420>gonna <00:30:09.595>need <00:30:09.770>just <00:30:09.945>a <00:30:10.120>single <00:30:10.295>query

588
00:30:11.405 --> 00:30:12.545
<00:30:11.405>to <00:30:11.661>get <00:30:11.918>all <00:30:12.174>the <00:30:12.431>information,

589
00:30:12.725 --> 00:30:14.305
<00:30:12.725>but <00:30:13.004>you'll <00:30:13.284>have <00:30:13.564>some <00:30:13.844>data <00:30:14.125>duplication.

590
00:30:14.685 --> 00:30:17.465
<00:30:14.685>But <00:30:15.151>why, <00:30:15.618>why <00:30:16.085>care?

591
00:30:18.805 --> 00:30:20.745
<00:30:18.805>And <00:30:19.005>another <00:30:19.205>thing <00:30:19.405>that <00:30:19.605>we <00:30:19.805>can <00:30:20.005>see <00:30:20.205>is

592
00:30:20.745 --> 00:30:23.745
<00:30:20.745>that <00:30:20.919>data <00:30:21.094>is <00:30:21.270>access <00:30:21.445>together <00:30:21.620>should <00:30:21.794>be <00:30:21.969>stored <00:30:22.145>together,

593
00:30:24.675 --> 00:30:27.905
<00:30:24.675>which <00:30:24.830>is <00:30:24.986>exactly <00:30:25.141>that <00:30:25.297>we <00:30:25.452>exa <00:30:25.608>you <00:30:25.763>know, <00:30:25.919>the <00:30:26.075>example

594
00:30:27.935 --> 00:30:32.625
<00:30:27.935>that <00:30:28.090>we <00:30:28.246>saw, <00:30:28.401>but <00:30:28.557>still, <00:30:28.712>I <00:30:28.868>am <00:30:29.023>sure <00:30:29.179>that <00:30:29.335>you

595
00:30:32.625 --> 00:30:35.305
<00:30:32.625>as <00:30:32.800>a <00:30:32.975>developer, <00:30:33.150>you <00:30:33.325>are <00:30:33.500>concerned <00:30:33.675>about <00:30:33.850>this <00:30:34.025>data

596
00:30:35.305 --> 00:30:37.345
<00:30:35.305>duplication <00:30:35.655>because <00:30:36.005>you're <00:30:36.355>not <00:30:36.705>used

597
00:30:37.345 --> 00:30:39.145
<00:30:37.345>to <00:30:37.811>duplicating <00:30:38.278>stuff <00:30:38.745>around.

598
00:30:39.275 --> 00:30:42.425
<00:30:39.275>We're <00:30:39.430>all <00:30:39.586>living <00:30:39.741>by <00:30:39.897>the <00:30:40.052>dry <00:30:40.208>principle <00:30:40.363>and <00:30:40.519>all <00:30:40.675>that.

599
00:30:42.565 --> 00:30:44.985
<00:30:42.565>So <00:30:42.765>how <00:30:42.965>do <00:30:43.165>we <00:30:43.365>deal <00:30:43.565>with <00:30:43.765>data <00:30:43.965>duplication?

600
00:30:47.425 --> 00:30:49.995
<00:30:47.425>Well, <00:30:47.625>we <00:30:47.825>can <00:30:48.024>look <00:30:48.225>at <00:30:48.425>different <00:30:48.625>scenarios <00:30:48.825>and

601
00:30:50.215 --> 00:30:53.315
<00:30:50.215>or <00:30:50.389>continue <00:30:50.564>convincing <00:30:50.740>you <00:30:50.915>that <00:30:51.090>data <00:30:51.264>duplication <00:30:51.439>is <00:30:51.615>okay,

602
00:30:54.045 --> 00:30:57.395
<00:30:54.045>especially <00:30:54.278>when <00:30:54.511>you're <00:30:54.745>dealing <00:30:54.978>with <00:30:55.211>historical <00:30:55.445>data

603
00:30:57.735 --> 00:30:58.995
<00:30:57.735>or <00:30:58.302>dynamic <00:30:58.869>objects.

604
00:30:59.295 --> 00:31:03.515
<00:30:59.295>And <00:30:59.435>in <00:30:59.575>this <00:30:59.715>specific <00:30:59.855>example, <00:30:59.995>we <00:31:00.135>have <00:31:00.275>a <00:31:00.415>system <00:31:00.555>for, <00:31:00.695>um,

605
00:31:03.925 --> 00:31:04.955
<00:31:03.925>performing <00:31:04.851>orders

606
00:31:05.935 --> 00:31:10.075
<00:31:05.935>and <00:31:06.110>we're <00:31:06.284>a <00:31:06.460>user, <00:31:06.635>the <00:31:06.810>user <00:31:06.985>with <00:31:07.159>username <00:31:07.335>John,

607
00:31:10.095 --> 00:31:11.635
<00:31:10.095>and <00:31:10.372>we <00:31:10.649>are <00:31:10.926>performing <00:31:11.203>an <00:31:11.481>order.

608
00:31:11.895 --> 00:31:14.075
<00:31:11.895>So <00:31:12.050>this <00:31:12.206>is <00:31:12.361>gonna <00:31:12.517>create <00:31:12.672>a <00:31:12.828>new <00:31:12.983>order <00:31:13.139>document <00:31:13.295>in

609
00:31:14.075 --> 00:31:15.395
<00:31:14.075>our <00:31:15.263>database.

610
00:31:16.175 --> 00:31:19.195
<00:31:16.175>And <00:31:16.330>for <00:31:16.486>the <00:31:16.641>address, <00:31:16.797>uh, <00:31:16.952>the <00:31:17.108>system <00:31:17.263>is <00:31:17.419>gonna <00:31:17.575>use

611
00:31:19.815 --> 00:31:20.955
<00:31:19.815>the <00:31:20.071>address <00:31:20.328>of <00:31:20.584>the <00:31:20.841>user.

612
00:31:21.175 --> 00:31:24.315
<00:31:21.175>So <00:31:21.330>this <00:31:21.486>is <00:31:21.641>gonna <00:31:21.797>be <00:31:21.952>saved <00:31:22.108>as <00:31:22.263>the <00:31:22.419>shipment <00:31:22.575>address

613
00:31:24.495 --> 00:31:25.555
<00:31:24.495>for <00:31:24.972>this <00:31:25.449>order.

614
00:31:27.215 --> 00:31:28.915
<00:31:27.215>And <00:31:27.495>what <00:31:27.774>if <00:31:28.054>we <00:31:28.334>go <00:31:28.615>ahead

615
00:31:28.935 --> 00:31:31.635
<00:31:28.935>and <00:31:29.110>change <00:31:29.284>the <00:31:29.460>address <00:31:29.635>of <00:31:29.810>the <00:31:29.985>user <00:31:30.159>later <00:31:30.335>on?

616
00:31:31.905 --> 00:31:35.395
<00:31:31.905>Well, <00:31:32.060>the <00:31:32.216>others <00:31:32.371>of <00:31:32.527>the <00:31:32.682>order <00:31:32.838>should <00:31:32.993>stay <00:31:33.149>the <00:31:33.305>same.

617
00:31:35.735 --> 00:31:38.875
<00:31:35.735>So <00:31:35.935>if <00:31:36.135>we <00:31:36.334>were <00:31:36.534>to <00:31:36.735>use <00:31:36.935>referencing <00:31:37.135>here,

618
00:31:39.065 --> 00:31:42.075
<00:31:39.065>this <00:31:39.345>will <00:31:39.625>actually <00:31:39.905>be, <00:31:40.185>um, <00:31:40.465>wrong

619
00:31:42.185 --> 00:31:45.995
<00:31:42.185>because <00:31:42.418>we <00:31:42.651>will <00:31:42.885>unintentionally <00:31:43.118>update <00:31:43.351>the <00:31:43.585>address

620
00:31:46.415 --> 00:31:48.235
<00:31:46.415>for <00:31:46.590>all <00:31:46.764>the <00:31:46.940>users, <00:31:47.115>uh, <00:31:47.290>for <00:31:47.465>all <00:31:47.639>the <00:31:47.815>orders

621
00:31:49.015 --> 00:31:51.755
<00:31:49.015>if <00:31:49.215>the <00:31:49.415>user <00:31:49.615>decides <00:31:49.815>to <00:31:50.015>change <00:31:50.215>their <00:31:50.415>address.

622
00:31:53.585 --> 00:31:56.285
<00:31:53.585>So <00:31:53.760>here <00:31:53.935>the <00:31:54.110>shipment <00:31:54.285>address <00:31:54.460>should <00:31:54.635>remain <00:31:54.810>the <00:31:54.985>same,

623
00:31:56.995 --> 00:31:58.805
<00:31:56.995>even <00:31:57.228>if <00:31:57.461>the <00:31:57.695>user <00:31:57.928>changes <00:31:58.161>their <00:31:58.395>address.

624
00:31:59.505 --> 00:32:02.325
<00:31:59.505>Um, <00:31:59.705>that's <00:31:59.905>why <00:32:00.105>we <00:32:00.305>need <00:32:00.505>to <00:32:00.705>use <00:32:00.905>duplication.

625
00:32:03.225 --> 00:32:06.005
<00:32:03.225>So <00:32:03.399>in <00:32:03.574>this <00:32:03.750>scenario, <00:32:03.925>in <00:32:04.100>this <00:32:04.274>case, <00:32:04.449>it's <00:32:04.625>okay

626
00:32:06.005 --> 00:32:08.205
<00:32:06.005>to <00:32:06.160>duplicate <00:32:06.316>data, <00:32:06.471>it's <00:32:06.627>actually <00:32:06.782>the <00:32:06.938>right <00:32:07.093>thing <00:32:07.249>to <00:32:07.405>do,

627
00:32:10.085 --> 00:32:14.985
<00:32:10.085>but <00:32:10.225>outside <00:32:10.365>of <00:32:10.505>that, <00:32:10.645>um, <00:32:10.785>we <00:32:10.925>have <00:32:11.065>cases <00:32:11.205>where <00:32:11.345>we <00:32:11.485>need

628
00:32:14.985 --> 00:32:15.985
<00:32:14.985>to <00:32:15.435>manage <00:32:15.885>duplication

629
00:32:16.845 --> 00:32:21.105
<00:32:16.845>and <00:32:16.985>inevitably <00:32:17.125>this <00:32:17.265>is <00:32:17.405>going <00:32:17.545>to <00:32:17.685>lead <00:32:17.825>to <00:32:17.965>writing <00:32:18.105>more <00:32:18.245>code

630
00:32:21.245 --> 00:32:24.105
<00:32:21.245>and <00:32:21.594>performing <00:32:21.945>more <00:32:22.294>update <00:32:22.645>operations.

631
00:32:25.125 --> 00:32:27.465
<00:32:25.125>So <00:32:25.358>when <00:32:25.591>you <00:32:25.825>are <00:32:26.058>duplicating, <00:32:26.291>you <00:32:26.525>should

632
00:32:28.065 --> 00:32:30.225
<00:32:28.065>actually <00:32:28.298>weigh <00:32:28.531>the <00:32:28.765>benefits <00:32:28.998>versus <00:32:29.231>the <00:32:29.465>efforts

633
00:32:30.525 --> 00:32:31.865
<00:32:30.525>of <00:32:30.927>managing <00:32:31.329>this <00:32:31.731>data.

634
00:32:32.565 --> 00:32:34.825
<00:32:32.565>So <00:32:32.915>just <00:32:33.265>think <00:32:33.615>about <00:32:33.965>it,

635
00:32:34.825 --> 00:32:36.785
<00:32:34.825>when <00:32:35.175>you're <00:32:35.525>modeling <00:32:35.875>your <00:32:36.225>application,

636
00:32:36.785 --> 00:32:40.005
<00:32:36.785>it's <00:32:37.065>not <00:32:37.345>a <00:32:37.625>straightforward <00:32:37.905>do <00:32:38.185>it

637
00:32:40.065 --> 00:32:43.845
<00:32:40.065>or <00:32:40.220>don't <00:32:40.376>do <00:32:40.531>it <00:32:40.687>scenario, <00:32:40.842>you <00:32:40.998>should <00:32:41.153>actually <00:32:41.309>see, <00:32:41.465>uh,

638
00:32:43.895 --> 00:32:45.245
<00:32:43.895>which <00:32:44.138>one <00:32:44.380>is <00:32:44.624>better <00:32:44.867>for <00:32:45.110>you.

639
00:32:46.665 --> 00:32:48.245
<00:32:46.665>And <00:32:47.014>when <00:32:47.365>you <00:32:47.715>go <00:32:48.065>ahead

640
00:32:48.505 --> 00:32:52.245
<00:32:48.505>and <00:32:48.738>handle <00:32:48.971>duplication, <00:32:49.205>you're <00:32:49.438>actually <00:32:49.671>handling <00:32:49.905>staleness.

641
00:32:52.705 --> 00:32:56.765
<00:32:52.705>So <00:32:52.860>sta <00:32:53.016>data <00:32:53.171>is <00:32:53.327>data <00:32:53.482>that <00:32:53.638>doesn't <00:32:53.793>reflect <00:32:53.949>reality <00:32:54.105>anymore.

642
00:32:57.785 --> 00:33:00.445
<00:32:57.785>And <00:32:57.925>still <00:32:58.065>data <00:32:58.205>may <00:32:58.345>be <00:32:58.485>caused <00:32:58.625>by <00:32:58.765>duplication, <00:32:58.905>may <00:32:59.045>be <00:32:59.185>caused

643
00:33:00.505 --> 00:33:03.445
<00:33:00.505>by, <00:33:00.705>uh, <00:33:00.905>a <00:33:01.105>long <00:33:01.305>list <00:33:01.505>of <00:33:01.705>other <00:33:01.905>things.

644
00:33:03.625 --> 00:33:06.325
<00:33:03.625>But, <00:33:03.858>uh, <00:33:04.091>here <00:33:04.325>we're <00:33:04.558>gonna <00:33:04.791>discuss <00:33:05.025>duplication.

645
00:33:06.325 --> 00:33:08.605
<00:33:06.325>That <00:33:06.525>is <00:33:06.725>still, <00:33:06.925>that <00:33:07.125>is <00:33:07.325>caused <00:33:07.525>by <00:33:07.725>duplication

646
00:33:10.225 --> 00:33:12.725
<00:33:10.225>and <00:33:10.425>stillness <00:33:10.625>is <00:33:10.824>inevitable <00:33:11.024>in <00:33:11.225>the <00:33:11.425>real <00:33:11.625>world.

647
00:33:12.905 --> 00:33:15.885
<00:33:12.905>And <00:33:13.045>the <00:33:13.185>actual <00:33:13.325>question <00:33:13.465>that <00:33:13.605>we <00:33:13.745>need <00:33:13.885>to <00:33:14.024>answer <00:33:14.165>is <00:33:14.305>for

648
00:33:16.065 --> 00:33:19.845
<00:33:16.065>how <00:33:16.220>long <00:33:16.376>can <00:33:16.531>we <00:33:16.687>tolerate <00:33:16.842>sta <00:33:16.998>date <00:33:17.153>in <00:33:17.309>our <00:33:17.465>system?

649
00:33:20.385 --> 00:33:22.885
<00:33:20.385>So <00:33:20.618>if <00:33:20.851>we're <00:33:21.085>dealing <00:33:21.318>with <00:33:21.551>financial <00:33:21.785>markets

650
00:33:23.265 --> 00:33:26.925
<00:33:23.265>or <00:33:23.545>flights, <00:33:23.825>um, <00:33:24.105>updates, <00:33:24.385>flight <00:33:24.665>times

651
00:33:27.225 --> 00:33:30.085
<00:33:27.225>or <00:33:27.458>anything <00:33:27.691>that <00:33:27.925>is <00:33:28.158>super <00:33:28.391>sensitive, <00:33:28.625>um,

652
00:33:31.225 --> 00:33:34.325
<00:33:31.225>or <00:33:31.425>s <00:33:31.625>should <00:33:31.824>be <00:33:32.024>refreshed <00:33:32.225>really, <00:33:32.425>really <00:33:32.625>often,

653
00:33:34.995 --> 00:33:39.325
<00:33:34.995>then <00:33:35.150>we <00:33:35.306>don't <00:33:35.461>have <00:33:35.617>a <00:33:35.772>very, <00:33:35.928>uh, <00:33:36.083>very <00:33:36.239>big <00:33:36.395>tolerance

654
00:33:39.585 --> 00:33:41.725
<00:33:39.585>for, <00:33:40.051>for <00:33:40.518>stale <00:33:40.985>data.

655
00:33:41.905 --> 00:33:44.605
<00:33:41.905>We <00:33:42.080>have <00:33:42.254>to <00:33:42.430>update <00:33:42.605>this <00:33:42.780>information <00:33:42.955>every <00:33:43.129>single <00:33:43.305>second

656
00:33:44.865 --> 00:33:46.925
<00:33:44.865>or <00:33:45.145>every <00:33:45.425>single <00:33:45.705>millisecond, <00:33:45.985>something <00:33:46.265>changes.

657
00:33:48.305 --> 00:33:51.605
<00:33:48.305>But <00:33:48.460>if <00:33:48.616>we're <00:33:48.771>dealing <00:33:48.927>with <00:33:49.082>the <00:33:49.238>system, <00:33:49.393>with <00:33:49.549>the <00:33:49.705>bookings

658
00:33:51.625 --> 00:33:56.005
<00:33:51.625>and <00:33:51.780>the <00:33:51.936>meeting <00:33:52.091>rooms, <00:33:52.247>then <00:33:52.402>should <00:33:52.558>we <00:33:52.713>ever <00:33:52.869>update, <00:33:53.025>um,

659
00:33:56.365 --> 00:33:58.405
<00:33:56.365>bookings <00:33:56.598>that <00:33:56.831>are <00:33:57.065>already <00:33:57.298>in <00:33:57.531>the <00:33:57.765>past?

660
00:33:58.635 --> 00:33:59.685
<00:33:58.635>Well, <00:33:59.107>maybe <00:33:59.580>not.

661
00:33:59.985 --> 00:34:03.485
<00:33:59.985>So <00:34:00.159>why <00:34:00.334>do <00:34:00.510>we <00:34:00.685>care <00:34:00.860>about, <00:34:01.034>um, <00:34:01.209>a <00:34:01.385>room

662
00:34:03.485 --> 00:34:05.285
<00:34:03.485>that <00:34:03.834>has <00:34:04.185>changed <00:34:04.534>its <00:34:04.885>name?

663
00:34:05.285 --> 00:34:07.525
<00:34:05.285>Because <00:34:05.485>'cause <00:34:05.685>someone <00:34:05.885>decided <00:34:06.085>to <00:34:06.285>change <00:34:06.485>the <00:34:06.685>name

664
00:34:07.525 --> 00:34:11.645
<00:34:07.525>of <00:34:07.680>the <00:34:07.836>room <00:34:07.991>and <00:34:08.147>should <00:34:08.302>we <00:34:08.458>update <00:34:08.613>that <00:34:08.769>in, <00:34:08.925>uh,

665
00:34:11.645 --> 00:34:12.805
<00:34:11.645>bookings <00:34:11.853>that <00:34:12.062>are <00:34:12.271>in <00:34:12.480>the <00:34:12.688>past?

666
00:34:12.835 --> 00:34:15.565
<00:34:12.835>Well, <00:34:13.068>maybe <00:34:13.301>we <00:34:13.534>shouldn't <00:34:13.768>update <00:34:14.001>it <00:34:14.235>ever.

667
00:34:16.345 --> 00:34:19.645
<00:34:16.344>So <00:34:16.544>we <00:34:16.745>should <00:34:16.944>identify <00:34:17.145>this <00:34:17.344>kind <00:34:17.544>of <00:34:17.745>threshold

668
00:34:19.645 --> 00:34:21.445
<00:34:19.645>that <00:34:19.925>we <00:34:20.205>have <00:34:20.485>for <00:34:20.764>stale <00:34:21.045>data.

669
00:34:23.255 --> 00:34:25.915
<00:34:23.255>And <00:34:23.535>once <00:34:23.815>we <00:34:24.095>answer <00:34:24.375>this <00:34:24.655>question

670
00:34:25.935 --> 00:34:28.435
<00:34:25.935>and <00:34:26.134>we <00:34:26.335>have <00:34:26.534>our <00:34:26.735>threshold <00:34:26.935>for <00:34:27.134>our <00:34:27.335>specific

671
00:34:28.945 --> 00:34:32.315
<00:34:28.945>application <00:34:29.145>use <00:34:29.345>case, <00:34:29.545>we <00:34:29.745>have <00:34:29.945>to <00:34:30.145>manage <00:34:30.345>stillness.

672
00:34:32.455 --> 00:34:35.435
<00:34:32.455>And <00:34:32.594>the <00:34:32.735>preferable <00:34:32.875>way <00:34:33.014>to <00:34:33.154>do <00:34:33.295>that <00:34:33.435>is <00:34:33.574>with <00:34:33.715>batch <00:34:33.855>updates.

673
00:34:35.935 --> 00:34:39.155
<00:34:35.935>So <00:34:36.110>you <00:34:36.284>shouldn't <00:34:36.460>update <00:34:36.634>data <00:34:36.810>every <00:34:36.985>second <00:34:37.159>serving <00:34:37.335>time.

674
00:34:39.375 --> 00:34:42.355
<00:34:39.375>Uh, <00:34:39.502>there <00:34:39.629>is <00:34:39.756>an <00:34:39.884>update <00:34:40.011>coming, <00:34:40.138>you <00:34:40.265>should <00:34:40.393>do <00:34:40.520>that <00:34:40.647>in <00:34:40.775>batches

675
00:34:43.135 --> 00:34:46.035
<00:34:43.135>and <00:34:43.275>let's <00:34:43.415>see <00:34:43.555>how <00:34:43.695>we <00:34:43.835>can <00:34:43.975>do <00:34:44.115>that <00:34:44.255>with <00:34:44.395>chain <00:34:44.535>streams.

676
00:34:46.225 --> 00:34:48.475
<00:34:46.225>This <00:34:46.380>is <00:34:46.536>a <00:34:46.691>feature <00:34:46.847>that <00:34:47.002>is <00:34:47.158>provided <00:34:47.313>by <00:34:47.469>MON <00:34:47.625>db.

677
00:34:49.015 --> 00:34:50.355
<00:34:49.014>So <00:34:49.417>it's <00:34:49.819>really <00:34:50.221>simple.

678
00:34:50.525 --> 00:34:53.235
<00:34:50.525>First <00:34:50.680>you <00:34:50.836>have <00:34:50.991>to <00:34:51.147>grab <00:34:51.302>the <00:34:51.458>collection <00:34:51.613>that <00:34:51.769>you're <00:34:51.925>working

679
00:34:53.305 --> 00:34:58.085
<00:34:53.304>with, <00:34:53.480>um, <00:34:53.654>then <00:34:53.830>you <00:34:54.004>have <00:34:54.179>to, <00:34:54.355>um, <00:34:54.529>select <00:34:54.705>uh,

680
00:34:58.085 --> 00:35:01.585
<00:34:58.085>kind <00:34:58.285>of <00:34:58.485>the <00:34:58.685>operation <00:34:58.885>that <00:34:59.085>you're <00:34:59.285>watching <00:34:59.485>for.

681
00:35:01.965 --> 00:35:05.545
<00:35:01.965>So <00:35:02.105>in <00:35:02.245>this <00:35:02.385>case, <00:35:02.525>we're <00:35:02.665>watching <00:35:02.805>for <00:35:02.945>updates <00:35:03.085>to <00:35:03.225>our, <00:35:03.365>uh,

682
00:35:05.545 --> 00:35:08.985
<00:35:05.545>user <00:35:05.700>collection <00:35:05.856>and <00:35:06.011>then <00:35:06.167>we <00:35:06.322>are <00:35:06.478>creating <00:35:06.633>a <00:35:06.789>change <00:35:06.945>stream

683
00:35:09.085 --> 00:35:10.945
<00:35:09.085>by <00:35:09.551>calling <00:35:10.018>collection <00:35:10.485>watch

684
00:35:11.085 --> 00:35:14.105
<00:35:11.085>and <00:35:11.260>providing <00:35:11.435>the <00:35:11.610>operation <00:35:11.785>that <00:35:11.960>we <00:35:12.135>are <00:35:12.310>watching <00:35:12.485>for.

685
00:35:14.885 --> 00:35:16.425
<00:35:14.885>And <00:35:15.116>every <00:35:15.347>time <00:35:15.578>there <00:35:15.809>is <00:35:16.040>a <00:35:16.271>change,

686
00:35:16.605 --> 00:35:19.705
<00:35:16.605>so <00:35:16.745>every <00:35:16.885>time <00:35:17.025>someone <00:35:17.165>updates <00:35:17.305>a <00:35:17.445>document <00:35:17.585>in <00:35:17.725>the <00:35:17.865>user <00:35:18.005>user's

687
00:35:19.705 --> 00:35:21.705
<00:35:19.705>collection, <00:35:20.055>we're <00:35:20.404>gonna <00:35:20.755>get <00:35:21.105>notified

688
00:35:21.735 --> 00:35:23.065
<00:35:21.735>through <00:35:22.134>this <00:35:22.533>change <00:35:22.932>stream

689
00:35:23.325 --> 00:35:26.945
<00:35:23.325>and <00:35:23.452>we <00:35:23.579>can <00:35:23.706>post <00:35:23.834>pass <00:35:23.961>in <00:35:24.088>a <00:35:24.215>call <00:35:24.343>back <00:35:24.470>that <00:35:24.597>will <00:35:24.725>gonna,

690
00:35:26.975 --> 00:35:28.985
<00:35:26.975>that <00:35:27.255>is <00:35:27.535>gonna <00:35:27.815>handle <00:35:28.095>this <00:35:28.375>change.

691
00:35:29.845 --> 00:35:31.065
<00:35:29.845>And <00:35:30.211>it <00:35:30.577>is <00:35:30.943>cobe.

692
00:35:31.125 --> 00:35:33.945
<00:35:31.125>We <00:35:31.325>can <00:35:31.525>simply <00:35:31.725>accumulate <00:35:31.925>the <00:35:32.125>changes <00:35:32.325>over <00:35:32.525>time

693
00:35:34.245 --> 00:35:37.805
<00:35:34.245>and <00:35:34.400>perform <00:35:34.556>a <00:35:34.711>batch <00:35:34.867>update <00:35:35.022>to <00:35:35.178>all <00:35:35.333>the <00:35:35.489>related <00:35:35.645>documents

694
00:35:38.505 --> 00:35:43.125
<00:35:38.505>and <00:35:38.632>we <00:35:38.759>can <00:35:38.886>perform <00:35:39.014>this <00:35:39.141>batch <00:35:39.268>updates <00:35:39.395>so <00:35:39.523>that <00:35:39.650>we <00:35:39.777>meet <00:35:39.905>this

695
00:35:43.885 --> 00:35:47.325
<00:35:43.885>threshold <00:35:44.060>that <00:35:44.235>we <00:35:44.410>identified <00:35:44.585>that <00:35:44.760>is <00:35:44.935>viable <00:35:45.110>for <00:35:45.285>our,

696
00:35:47.945 --> 00:35:48.965
<00:35:47.945>for <00:35:48.404>our <00:35:48.863>application.

697
00:35:49.825 --> 00:35:52.685
<00:35:49.825>If <00:35:49.964>you <00:35:50.105>wanna <00:35:50.245>see <00:35:50.384>a <00:35:50.524>full <00:35:50.665>tutorial, <00:35:50.805>follow <00:35:50.944>this <00:35:51.085>link, <00:35:51.225>um,

698
00:35:52.995 --> 00:35:57.005
<00:35:52.995>it's, <00:35:53.275>it's <00:35:53.555>really, <00:35:53.835>um, <00:35:54.115>well <00:35:54.395>explained

699
00:35:57.065 --> 00:35:58.405
<00:35:57.065>and <00:35:57.366>it's <00:35:57.668>using <00:35:57.969>node <00:35:58.271>js

700
00:35:58.405 --> 00:36:01.925
<00:35:58.405>but <00:35:58.532>it <00:35:58.659>can <00:35:58.786>be <00:35:58.914>applied <00:35:59.041>to <00:35:59.168>our, <00:35:59.295>to <00:35:59.423>other <00:35:59.550>languages <00:35:59.677>as <00:35:59.805>well.

701
00:36:04.705 --> 00:36:08.325
<00:36:04.705>So <00:36:04.860>what <00:36:05.016>is <00:36:05.171>the <00:36:05.327>most <00:36:05.482>important <00:36:05.638>takeaway <00:36:05.793>from <00:36:05.949>this, <00:36:06.105>um,

702
00:36:08.685 --> 00:36:09.805
<00:36:08.685>presentation <00:36:09.692>is

703
00:36:09.805 --> 00:36:12.965
<00:36:09.805>that <00:36:09.980>the <00:36:10.154>application <00:36:10.330>use <00:36:10.504>cases <00:36:10.680>should <00:36:10.855>drive <00:36:11.029>data <00:36:11.205>molding.

704
00:36:12.965 --> 00:36:14.205
<00:36:12.965>It <00:36:13.151>shouldn't <00:36:13.337>be <00:36:13.523>the <00:36:13.709>other <00:36:13.895>way <00:36:14.081>around.

705
00:36:14.905 --> 00:36:18.005
<00:36:14.905>So <00:36:15.138>the <00:36:15.371>way <00:36:15.605>you're <00:36:15.838>building <00:36:16.071>your <00:36:16.305>application

706
00:36:18.065 --> 00:36:22.235
<00:36:18.065>and <00:36:18.220>you're <00:36:18.376>using <00:36:18.531>your <00:36:18.687>data <00:36:18.842>should <00:36:18.998>actually <00:36:19.153>tell <00:36:19.309>you <00:36:19.465>how

707
00:36:22.235 --> 00:36:23.635
<00:36:22.235>to <00:36:22.487>store <00:36:22.739>it <00:36:22.991>in <00:36:23.243>the <00:36:23.495>database

708
00:36:24.295 --> 00:36:26.155
<00:36:24.295>and <00:36:24.495>you <00:36:24.695>shouldn't <00:36:24.895>start <00:36:25.095>the <00:36:25.295>other <00:36:25.495>way <00:36:25.695>around,

709
00:36:26.205 --> 00:36:27.995
<00:36:26.205>which <00:36:26.438>is <00:36:26.671>often <00:36:26.904>common <00:36:27.138>when <00:36:27.371>you're <00:36:27.605>dealing

710
00:36:27.995 --> 00:36:30.035
<00:36:27.995>with <00:36:28.461>traditional <00:36:28.928>SQL <00:36:29.395>databases.

711
00:36:32.005 --> 00:36:33.225
<00:36:32.005>So <00:36:32.279>how <00:36:32.554>do <00:36:32.828>you <00:36:33.103>start?

712
00:36:33.375 --> 00:36:35.425
<00:36:33.375>Well, <00:36:33.655>you <00:36:33.935>can <00:36:34.215>answer <00:36:34.495>these <00:36:34.775>questions

713
00:36:35.525 --> 00:36:38.585
<00:36:35.525>and <00:36:35.652>this <00:36:35.779>is <00:36:35.906>gonna <00:36:36.034>set <00:36:36.161>you <00:36:36.288>on <00:36:36.415>the <00:36:36.543>right <00:36:36.670>path <00:36:36.797>to, <00:36:36.925>um,

714
00:36:39.065 --> 00:36:41.185
<00:36:39.065>building <00:36:39.265>a <00:36:39.465>right, <00:36:39.665>uh, <00:36:39.865>a <00:36:40.065>nice <00:36:40.265>data <00:36:40.465>model

715
00:36:41.285 --> 00:36:43.385
<00:36:41.285>for <00:36:41.751>your <00:36:42.218>NoSQL <00:36:42.685>database.

716
00:36:43.915 --> 00:36:46.785
<00:36:43.915>First, <00:36:44.115>identify <00:36:44.315>the <00:36:44.515>logical <00:36:44.715>units <00:36:44.915>in <00:36:45.115>your <00:36:45.315>application,

717
00:36:47.055 --> 00:36:49.305
<00:36:47.055>then <00:36:47.335>identify <00:36:47.615>the <00:36:47.895>relationships <00:36:48.174>between <00:36:48.455>them,

718
00:36:49.765 --> 00:36:52.825
<00:36:49.765>and <00:36:49.920>then <00:36:50.076>finally <00:36:50.231>identify <00:36:50.387>the <00:36:50.542>queries <00:36:50.698>that <00:36:50.853>are <00:36:51.009>gonna <00:36:51.165>be

719
00:36:53.625 --> 00:36:56.865
<00:36:53.625>critical <00:36:53.858>or <00:36:54.091>most <00:36:54.325>important <00:36:54.558>to <00:36:54.791>your <00:36:55.025>application.

720
00:36:59.105 --> 00:37:02.755
<00:36:59.105>Alright, <00:36:59.260>let's <00:36:59.416>quickly <00:36:59.571>summarize <00:36:59.727>all <00:36:59.882>the <00:37:00.038>things <00:37:00.193>that <00:37:00.349>we <00:37:00.505>saw

721
00:37:02.825 --> 00:37:04.555
<00:37:02.825>with <00:37:03.174>a <00:37:03.524>few <00:37:03.875>key <00:37:04.225>takeaways.

722
00:37:05.205 --> 00:37:06.675
<00:37:05.205>First, <00:37:05.646>I'm <00:37:06.087>gonna <00:37:06.528>repeat

723
00:37:06.675 --> 00:37:09.155
<00:37:06.675>that <00:37:06.875>model <00:37:07.075>data <00:37:07.275>based <00:37:07.475>on <00:37:07.675>your <00:37:07.875>use <00:37:08.075>cases.

724
00:37:09.855 --> 00:37:13.435
<00:37:09.855>Second <00:37:10.030>ality <00:37:10.205>into <00:37:10.380>account <00:37:10.555>when <00:37:10.730>you're <00:37:10.905>modeling <00:37:11.080>quantum <00:37:11.255>many

725
00:37:13.435 --> 00:37:15.675
<00:37:13.435>relationships <00:37:13.668>because <00:37:13.901>this <00:37:14.134>is <00:37:14.368>gonna <00:37:14.601>give <00:37:14.835>you

726
00:37:15.675 --> 00:37:16.875
<00:37:15.675>the <00:37:16.035>right <00:37:16.395>data <00:37:16.755>model.

727
00:37:18.565 --> 00:37:21.415
<00:37:18.565>Also <00:37:18.798>key <00:37:19.031>logical <00:37:19.265>units <00:37:19.498>in <00:37:19.731>different <00:37:19.965>collections

728
00:37:22.075 --> 00:37:24.175
<00:37:22.075>unless <00:37:22.308>you're <00:37:22.541>afraid <00:37:22.774>to, <00:37:23.008>you're <00:37:23.241>not <00:37:23.475>afraid

729
00:37:24.175 --> 00:37:25.255
<00:37:24.175>to <00:37:24.499>migrate <00:37:24.823>them <00:37:25.147>later.

730
00:37:26.985 --> 00:37:31.685
<00:37:26.985>And <00:37:27.160>finally <00:37:27.335>manage <00:37:27.510>the <00:37:27.685>and <00:37:27.860>duplication <00:37:28.035>with <00:37:28.210>batch <00:37:28.385>updates

731
00:37:31.785 --> 00:37:34.245
<00:37:31.785>and <00:37:32.018>with <00:37:32.251>change <00:37:32.484>streams <00:37:32.718>in <00:37:32.951>MON <00:37:33.185>db.

732
00:37:35.265 --> 00:37:37.645
<00:37:35.265>So <00:37:35.615>thank <00:37:35.964>you <00:37:36.315>for <00:37:36.665>joining.

733
00:37:37.785 --> 00:37:41.085
<00:37:37.785>The <00:37:37.901>first <00:37:38.018>link <00:37:38.134>that <00:37:38.251>we <00:37:38.368>have <00:37:38.484>here <00:37:38.601>is <00:37:38.718>a <00:37:38.835>link <00:37:38.951>to <00:37:39.068>the <00:37:39.185>slides

734
00:37:41.865 --> 00:37:43.605
<00:37:41.865>and <00:37:42.098>this <00:37:42.331>is <00:37:42.564>gonna <00:37:42.798>also <00:37:43.031>lead <00:37:43.265>it

735
00:37:43.605 --> 00:37:46.645
<00:37:43.605>to <00:37:43.721>all <00:37:43.838>the <00:37:43.955>other <00:37:44.071>links <00:37:44.188>we <00:37:44.305>have <00:37:44.421>on <00:37:44.538>this, <00:37:44.655>um, <00:37:44.771>on <00:37:44.888>this <00:37:45.005>slide.

736
00:37:47.225 --> 00:37:50.485
<00:37:47.225>So <00:37:47.424>there <00:37:47.625>is <00:37:47.825>this <00:37:48.025>super <00:37:48.225>nice <00:37:48.424>free <00:37:48.625>course

737
00:37:51.225 --> 00:37:54.045
<00:37:51.225>for <00:37:51.505>data <00:37:51.785>modeling <00:37:52.065>at <00:37:52.345>MongoDB <00:37:52.625>University.

738
00:37:54.825 --> 00:37:57.765
<00:37:54.825>It <00:37:55.000>explains, <00:37:55.174>uh, <00:37:55.350>into <00:37:55.524>a <00:37:55.700>lot <00:37:55.875>more <00:37:56.049>detail <00:37:56.225>everything

739
00:37:57.765 --> 00:38:00.125
<00:37:57.765>that <00:37:57.964>we <00:37:58.165>saw <00:37:58.365>today <00:37:58.565>and <00:37:58.765>it <00:37:58.964>goes, <00:37:59.165>uh,

740
00:38:00.125 --> 00:38:02.325
<00:38:00.125>through <00:38:00.358>different <00:38:00.591>patterns <00:38:00.825>that <00:38:01.058>you <00:38:01.291>can <00:38:01.525>follow

741
00:38:02.545 --> 00:38:05.205
<00:38:02.545>to <00:38:02.825>model <00:38:03.105>your <00:38:03.385>data <00:38:03.665>more <00:38:03.945>successfully

742
00:38:05.385 --> 00:38:08.805
<00:38:05.385>and <00:38:05.525>it's <00:38:05.665>gonna <00:38:05.805>leave <00:38:05.945>you <00:38:06.085>to <00:38:06.225>a <00:38:06.365>more <00:38:06.505>performance <00:38:06.645>data <00:38:06.785>model.

743
00:38:09.665 --> 00:38:11.445
<00:38:09.665>We <00:38:09.865>also <00:38:10.065>have <00:38:10.265>a <00:38:10.465>bunch <00:38:10.665>of <00:38:10.865>book <00:38:11.065>posts

744
00:38:11.465 --> 00:38:15.605
<00:38:11.465>and <00:38:11.605>book <00:38:11.745>post <00:38:11.885>series <00:38:12.025>around <00:38:12.165>the <00:38:12.305>same <00:38:12.445>topic, <00:38:12.585>so <00:38:12.725>make <00:38:12.865>sure

745
00:38:15.625 --> 00:38:19.085
<00:38:15.625>to <00:38:15.780>check <00:38:15.936>this <00:38:16.091>out <00:38:16.247>if <00:38:16.402>you're <00:38:16.558>looking <00:38:16.713>for <00:38:16.869>more <00:38:17.025>information,

746
00:38:19.465 --> 00:38:20.645
<00:38:19.465>um, <00:38:19.819>about <00:38:20.173>data <00:38:20.527>modeling.

747
00:38:21.775 --> 00:38:24.725
<00:38:21.775>Thank <00:38:21.915>you. <00:38:22.055>I'm <00:38:22.195>gonna <00:38:22.335>leave <00:38:22.475>this <00:38:22.615>slides <00:38:22.755>on <00:38:22.895>for <00:38:23.035>a <00:38:23.175>bit

748
00:38:25.105 --> 00:38:29.095
<00:38:25.105>and <00:38:25.280>um, <00:38:25.455>you <00:38:25.630>can <00:38:25.805>just, <00:38:25.980>uh, <00:38:26.155>take <00:38:26.330>a <00:38:26.505>screenshot

749
00:38:29.155 --> 00:38:30.535
<00:38:29.155>or <00:38:29.569>anything <00:38:29.983>like <00:38:30.397>that.

750
00:38:30.715 --> 00:38:34.015
<00:38:30.715>I'm <00:38:30.855>also <00:38:30.995>gonna <00:38:31.135>tweet <00:38:31.275>it, <00:38:31.415>uh, <00:38:31.555>from <00:38:31.695>my <00:38:31.835>Twitter <00:38:31.975>account, <00:38:32.115>which,

751
00:38:34.755 --> 00:38:38.125
<00:38:34.755>uh, <00:38:34.882>the <00:38:35.009>handle <00:38:35.136>for <00:38:35.264>it <00:38:35.391>is <00:38:35.518>at <00:38:35.645>the <00:38:35.773>bottom <00:38:35.900>right <00:38:36.027>page, <00:38:36.155>uh,

752
00:38:38.265 --> 00:38:41.345
<00:38:38.265>bottom <00:38:38.545>right <00:38:38.825>side <00:38:39.105>of <00:38:39.384>the <00:38:39.665>slide.

753
00:38:42.125 --> 00:38:44.585
<00:38:42.125>So <00:38:42.265>you <00:38:42.405>can <00:38:42.545>find <00:38:42.685>it <00:38:42.825>on <00:38:42.965>Twitter <00:38:43.105>as <00:38:43.245>well. <00:38:43.385>Thank <00:38:43.525>you.

754
00:38:47.245 --> 00:38:48.575
<00:38:47.245>Awesome. <00:38:48.442>Uh,

755
00:38:49.055 --> 00:38:51.695
<00:38:49.055>I <00:38:49.171>I <00:38:49.288>had <00:38:49.404>a <00:38:49.521>little <00:38:49.638>blast <00:38:49.754>from <00:38:49.871>the <00:38:49.988>past <00:38:50.105>from <00:38:50.221>when <00:38:50.338>I <00:38:50.455>was

756
00:38:51.895 --> 00:38:53.535
<00:38:51.895>learning <00:38:52.175>my <00:38:52.455>SQL <00:38:52.735>back <00:38:53.015>in <00:38:53.295>school

757
00:38:54.155 --> 00:38:55.775
<00:38:54.155>and <00:38:54.435>yeah, <00:38:54.715>I <00:38:54.995>recognized <00:38:55.275>a <00:38:55.555>lot

758
00:38:55.775 --> 00:38:57.535
<00:38:55.775>of <00:38:56.055>the <00:38:56.335>patterns <00:38:56.615>you <00:38:56.895>are <00:38:57.175>mentioning.

759
00:38:57.915 --> 00:39:00.335
<00:38:57.915>Uh, <00:38:58.115>I <00:38:58.315>was <00:38:58.515>thinking <00:38:58.715>of <00:38:58.915>the <00:38:59.115>term <00:38:59.315>normalization.

760
00:39:00.435 --> 00:39:03.575
<00:39:00.435>Is <00:39:00.562>that <00:39:00.689>a <00:39:00.816>myquel <00:39:00.944>thing <00:39:01.071>or <00:39:01.198>is <00:39:01.325>that <00:39:01.453>not <00:39:01.580>used <00:39:01.707>in? <00:39:01.835>No,

761
00:39:05.515 --> 00:39:06.815
<00:39:05.515>Uh, <00:39:05.807>it <00:39:06.100>can <00:39:06.392>be <00:39:06.685>used

762
00:39:06.875 --> 00:39:11.015
<00:39:06.875>but <00:39:07.002>it's <00:39:07.129>really <00:39:07.256>not, <00:39:07.384>not, <00:39:07.511>um, <00:39:07.638>a <00:39:07.765>thing <00:39:07.893>that <00:39:08.020>is <00:39:08.147>important <00:39:08.275>in,

763
00:39:11.355 --> 00:39:14.175
<00:39:11.355>um, <00:39:11.635>in <00:39:11.915>NoSQL <00:39:12.195>or <00:39:12.475>document <00:39:12.755>databases.

764
00:39:14.715 --> 00:39:17.375
<00:39:14.715>So <00:39:14.995>normalization <00:39:15.275>is <00:39:15.555>basically <00:39:15.835>the <00:39:16.115>process

765
00:39:17.475 --> 00:39:20.415
<00:39:17.475>of <00:39:17.650>splitting <00:39:17.825>all <00:39:18.000>the <00:39:18.174>data <00:39:18.350>into <00:39:18.525>different <00:39:18.700>tables <00:39:18.875>so

766
00:39:20.415 --> 00:39:22.695
<00:39:20.415>that <00:39:20.765>you <00:39:21.115>avoid <00:39:21.465>duplication <00:39:21.815>eventually.

767
00:39:23.595 --> 00:39:27.015
<00:39:23.595>And <00:39:23.722>it's <00:39:23.849>a <00:39:23.976>thing <00:39:24.104>that <00:39:24.231>was <00:39:24.358>invented <00:39:24.485>in <00:39:24.613>the <00:39:24.740>seventies <00:39:24.867>when <00:39:24.995>SQL

768
00:39:27.215 --> 00:39:28.695
<00:39:27.215>databases <00:39:27.659>were <00:39:28.103>also <00:39:28.547>invented

769
00:39:29.435 --> 00:39:34.335
<00:39:29.435>and <00:39:29.562>it's <00:39:29.689>really <00:39:29.816>leads <00:39:29.944>you <00:39:30.071>to <00:39:30.198>having, <00:39:30.325>um, <00:39:30.453>as, <00:39:30.580>as <00:39:30.707>less <00:39:30.835>using

770
00:39:34.435 --> 00:39:35.895
<00:39:34.435>as <00:39:34.763>less <00:39:35.092>storage <00:39:35.420>as <00:39:35.749>possible.

771
00:39:36.115 --> 00:39:39.335
<00:39:36.115>Mm-hmm. <00:39:36.314>But <00:39:36.515>nowadays <00:39:36.714>storage <00:39:36.915>is <00:39:37.115>not <00:39:37.314>that <00:39:37.515>expensive.

772
00:39:39.515 --> 00:39:44.335
<00:39:39.515>So <00:39:39.670>it's, <00:39:39.826>it's <00:39:39.981>um, <00:39:40.137>maybe <00:39:40.292>a <00:39:40.448>better, <00:39:40.603>a <00:39:40.759>better <00:39:40.915>solution

773
00:39:44.355 --> 00:39:47.175
<00:39:44.355>to <00:39:44.821>apply <00:39:45.288>some <00:39:45.755>normalization

774
00:39:47.235 --> 00:39:49.815
<00:39:47.235>or <00:39:47.435>use <00:39:47.635>some <00:39:47.835>duplication <00:39:48.035>your, <00:39:48.235>in <00:39:48.435>your <00:39:48.635>model

775
00:39:49.855 --> 00:39:53.975
<00:39:49.855>because <00:39:50.010>this <00:39:50.166>is <00:39:50.321>gonna <00:39:50.477>lead <00:39:50.632>it <00:39:50.788>to, <00:39:50.943>uh, <00:39:51.099>more, <00:39:51.255>um,

776
00:39:54.475 --> 00:39:57.535
<00:39:54.475>to <00:39:54.941>improved <00:39:55.408>developer <00:39:55.875>productivity,

777
00:39:57.625 --> 00:39:59.575
<00:39:57.625>which <00:39:57.858>is <00:39:58.091>a <00:39:58.325>bit <00:39:58.558>more <00:39:58.791>expensive <00:39:59.025>nowadays.

778
00:40:00.915 --> 00:40:02.855
<00:40:00.915>Uh, <00:40:01.265>yeah, <00:40:01.615>that's <00:40:01.965>true. <00:40:02.315>Yeah.

779
00:40:03.195 --> 00:40:05.135
<00:40:03.195>Oh, <00:40:03.370>my <00:40:03.545>age <00:40:03.720>is <00:40:03.895>really <00:40:04.070>showing <00:40:04.245>with <00:40:04.420>this <00:40:04.595>question.

780
00:40:05.225 --> 00:40:06.615
<00:40:05.225>Sorry <00:40:05.642>for <00:40:06.058>that. <00:40:06.475>Um,

781
00:40:06.905 --> 00:40:07.905
<00:40:06.905>Don't <00:40:07.205>worry <00:40:07.505>about <00:40:07.805>it.

782
00:40:08.555 --> 00:40:11.895
<00:40:08.555>People <00:40:08.710>still <00:40:08.866>use <00:40:09.021>SQL <00:40:09.177>databases, <00:40:09.332>believe <00:40:09.488>it <00:40:09.643>or <00:40:09.799>not. <00:40:09.955>Good.

783
00:40:12.885 --> 00:40:16.415
<00:40:12.885>Alright. <00:40:13.060>Uh, <00:40:13.235>first <00:40:13.410>question <00:40:13.585>is <00:40:13.760>from <00:40:13.935>a <00:40:14.110>anonymous <00:40:14.285>visitor.

784
00:40:17.035 --> 00:40:18.895
<00:40:17.035>Um, <00:40:17.501>and <00:40:17.968>he's, <00:40:18.435>he

785
00:40:18.895 --> 00:40:21.615
<00:40:18.895>or <00:40:19.070>she <00:40:19.245>is <00:40:19.420>asking, <00:40:19.595>are <00:40:19.770>these <00:40:19.945>rules <00:40:20.120>documented <00:40:20.295>anywhere?

786
00:40:21.775 --> 00:40:22.775
<00:40:21.775>'cause <00:40:22.075>they <00:40:22.375>are <00:40:22.675>amazing.

787
00:40:24.685 --> 00:40:26.535
<00:40:24.685>They're <00:40:25.151>not <00:40:25.618>really <00:40:26.085>documented

788
00:40:26.535 --> 00:40:31.215
<00:40:26.535>because <00:40:26.662>we <00:40:26.789>kind <00:40:26.916>of <00:40:27.044>try <00:40:27.171>not <00:40:27.298>to, <00:40:27.425>um, <00:40:27.553>throw <00:40:27.680>these <00:40:27.807>as, <00:40:27.935>uh,

789
00:40:31.385 --> 00:40:35.135
<00:40:31.385>algorithms <00:40:31.665>or <00:40:31.945>recipes, <00:40:32.225>um, <00:40:32.505>at <00:40:32.785>people.

790
00:40:35.395 --> 00:40:38.535
<00:40:35.395>But <00:40:35.595>we <00:40:35.795>do <00:40:35.995>have <00:40:36.195>documentation <00:40:36.395>about <00:40:36.595>data <00:40:36.795>modeling

791
00:40:38.645 --> 00:40:40.655
<00:40:38.645>that <00:40:38.845>is <00:40:39.045>kind <00:40:39.245>of <00:40:39.445>going <00:40:39.645>to <00:40:39.845>lead <00:40:40.045>you

792
00:40:41.035 --> 00:40:44.535
<00:40:41.035>or <00:40:41.174>guide <00:40:41.315>you <00:40:41.455>through <00:40:41.595>the <00:40:41.734>same, <00:40:41.875>um, <00:40:42.015>through <00:40:42.154>the <00:40:42.295>same <00:40:42.435>ideas.

793
00:40:45.875 --> 00:40:47.695
<00:40:45.875>And, <00:40:46.341>um, <00:40:46.808>they're, <00:40:47.275>it's,

794
00:40:47.695 --> 00:40:49.615
<00:40:47.695>it's <00:40:47.895>not <00:40:48.095>written <00:40:48.295>down <00:40:48.495>in <00:40:48.695>the <00:40:48.895>same <00:40:49.095>way,

795
00:40:50.235 --> 00:40:52.855
<00:40:50.235>but <00:40:50.435>if <00:40:50.635>you <00:40:50.835>google <00:40:51.035>data <00:40:51.235>modeling <00:40:51.435>with <00:40:51.635>TB

796
00:40:52.855 --> 00:40:55.215
<00:40:52.855>and <00:40:53.010>then <00:40:53.166>head <00:40:53.321>to <00:40:53.477>do <00:40:53.632>the <00:40:53.788>documentation, <00:40:53.943>you <00:40:54.099>are <00:40:54.255>gonna,

797
00:40:55.835 --> 00:40:56.935
<00:40:55.835>uh, <00:40:56.330>discover <00:40:56.825>them.

798
00:40:57.725 --> 00:41:00.095
<00:40:57.725>Okay. <00:40:57.880>Or <00:40:58.036>you <00:40:58.191>can <00:40:58.347>just <00:40:58.502>use <00:40:58.658>the <00:40:58.813>slides, <00:40:58.969>the <00:40:59.125>slides

799
00:41:00.155 --> 00:41:02.015
<00:41:00.155>as <00:41:00.505>a <00:41:00.855>source <00:41:01.205>as <00:41:01.555>well.

800
00:41:02.805 --> 00:41:04.695
<00:41:02.805>Yeah, <00:41:03.085>probably <00:41:03.365>that <00:41:03.645>course <00:41:03.924>that's, <00:41:04.205>uh,

801
00:41:05.115 --> 00:41:07.295
<00:41:05.115>listed <00:41:05.314>in <00:41:05.515>the <00:41:05.714>last <00:41:05.915>slide <00:41:06.115>you <00:41:06.314>just <00:41:06.515>mentioned.

802
00:41:08.605 --> 00:41:11.255
<00:41:08.605>Yeah, <00:41:08.780>the <00:41:08.955>course <00:41:09.130>is <00:41:09.305>also <00:41:09.480>really <00:41:09.655>good <00:41:09.830>if <00:41:10.005>you

803
00:41:12.305 --> 00:41:15.055
<00:41:12.305>wanna <00:41:12.480>spend <00:41:12.654>some <00:41:12.830>time <00:41:13.004>and <00:41:13.180>look <00:41:13.355>through <00:41:13.529>the <00:41:13.705>videos.

804
00:41:15.205 --> 00:41:18.695
<00:41:15.205>They're <00:41:15.404>really, <00:41:15.605>really <00:41:15.805>eyeopening <00:41:16.005>how, <00:41:16.205>how <00:41:16.404>you <00:41:16.605>should,

805
00:41:19.275 --> 00:41:20.695
<00:41:19.275>um, <00:41:19.701>model <00:41:20.127>your <00:41:20.553>data.

806
00:41:22.425 --> 00:41:25.795
<00:41:22.425>Okay, <00:41:22.600>nice. <00:41:22.775>Thanks. <00:41:22.950>Uh, <00:41:23.125>next <00:41:23.300>question <00:41:23.475>is <00:41:23.650>from <00:41:23.825>Karina.

807
00:41:26.575 --> 00:41:29.075
<00:41:26.575>Are <00:41:26.774>there <00:41:26.975>specific, <00:41:27.174>uh, <00:41:27.375>cases <00:41:27.575>where <00:41:27.774>it's <00:41:27.975>better

808
00:41:29.095 --> 00:41:32.275
<00:41:29.095>or <00:41:29.328>recommended <00:41:29.561>to <00:41:29.794>use <00:41:30.028>NoSQL <00:41:30.261>databases <00:41:30.495>instead

809
00:41:32.275 --> 00:41:33.285
<00:41:32.275>of <00:41:32.729>SQL <00:41:33.183>databases?

810
00:41:34.625 --> 00:41:36.125
<00:41:34.625>Um, <00:41:34.962>that's <00:41:35.300>a <00:41:35.637>tricky <00:41:35.975>one

811
00:41:36.125 --> 00:41:39.285
<00:41:36.125>because <00:41:36.591>usually, <00:41:37.058>I <00:41:37.525>mean,

812
00:41:39.375 --> 00:41:41.925
<00:41:39.375>maybe <00:41:39.550>in <00:41:39.725>the <00:41:39.900>past <00:41:40.075>there <00:41:40.250>were <00:41:40.425>like <00:41:40.600>these <00:41:40.775>hard

813
00:41:41.985 --> 00:41:45.045
<00:41:41.985>differentiations, <00:41:42.451>but <00:41:42.918>SQL <00:41:43.385>databases

814
00:41:45.045 --> 00:41:48.685
<00:41:45.045>and <00:41:45.200>no <00:41:45.356>SQL <00:41:45.511>databases <00:41:45.667>are <00:41:45.822>nowadays, <00:41:45.978>um, <00:41:46.133>a <00:41:46.289>lot <00:41:46.445>more

815
00:41:49.995 --> 00:41:52.365
<00:41:49.995>kind <00:41:50.345>of <00:41:50.694>general <00:41:51.045>purpose <00:41:51.395>databases.

816
00:41:52.365 --> 00:41:54.965
<00:41:52.365>They <00:41:52.564>don't <00:41:52.765>have <00:41:52.964>like <00:41:53.165>a <00:41:53.365>specified <00:41:53.564>use <00:41:53.765>case.

817
00:41:55.745 --> 00:42:00.645
<00:41:55.745>Um, <00:41:55.884>you <00:41:56.025>can, <00:41:56.165>you <00:41:56.305>can <00:41:56.444>use, <00:41:56.585>um, <00:41:56.725>no <00:41:56.865>SQL <00:41:57.005>databases <00:41:57.145>in

818
00:42:01.275 --> 00:42:02.525
<00:42:01.275>financial <00:42:02.400>applications

819
00:42:02.745 --> 00:42:04.805
<00:42:02.745>or <00:42:02.978>in <00:42:03.211>medical <00:42:03.444>applications <00:42:03.678>and <00:42:03.911>all <00:42:04.145>that.

820
00:42:04.985 --> 00:42:06.805
<00:42:04.985>And <00:42:05.160>you <00:42:05.335>can <00:42:05.510>do <00:42:05.685>the <00:42:05.860>same <00:42:06.035>with <00:42:06.210>SQL <00:42:06.385>application.

821
00:42:06.805 --> 00:42:09.605
<00:42:06.805>So <00:42:07.085>the <00:42:07.365>short <00:42:07.645>answer <00:42:07.924>is <00:42:08.205>no,

822
00:42:09.605 --> 00:42:13.405
<00:42:09.605>there <00:42:09.745>is <00:42:09.885>no <00:42:10.025>like <00:42:10.165>a <00:42:10.305>clear <00:42:10.445>differentiation <00:42:10.585>when <00:42:10.725>you <00:42:10.865>should <00:42:11.005>use

823
00:42:13.465 --> 00:42:15.885
<00:42:13.465>one <00:42:13.640>or <00:42:13.815>the <00:42:13.990>other <00:42:14.165>based <00:42:14.340>on <00:42:14.515>your <00:42:14.690>use <00:42:14.865>case.

824
00:42:16.785 --> 00:42:20.165
<00:42:16.785>Um, <00:42:17.065>maybe <00:42:17.345>if <00:42:17.625>you're <00:42:17.904>building <00:42:18.185>something

825
00:42:20.165 --> 00:42:23.045
<00:42:20.165>that <00:42:20.365>is <00:42:20.565>really <00:42:20.765>interconnected, <00:42:20.965>like <00:42:21.165>a <00:42:21.365>social <00:42:21.565>network,

826
00:42:23.055 --> 00:42:24.925
<00:42:23.055>which <00:42:23.404>is <00:42:23.754>a <00:42:24.105>number <00:42:24.455>example,

827
00:42:24.985 --> 00:42:26.845
<00:42:24.985>but <00:42:25.335>people, <00:42:25.685>um, <00:42:26.035>use <00:42:26.385>it,

828
00:42:27.395 --> 00:42:29.325
<00:42:27.395>then <00:42:27.628>you <00:42:27.861>should <00:42:28.095>use <00:42:28.328>a <00:42:28.561>graph <00:42:28.795>database,

829
00:42:29.465 --> 00:42:34.365
<00:42:29.465>but <00:42:29.620>then <00:42:29.776>you <00:42:29.931>can <00:42:30.087>also <00:42:30.242>use, <00:42:30.398>um, <00:42:30.553>the <00:42:30.709>graph <00:42:30.865>capabilities

830
00:42:34.435 --> 00:42:36.285
<00:42:34.435>that <00:42:34.785>MongoDB <00:42:35.134>provides <00:42:35.485>as <00:42:35.835>well.

831
00:42:36.385 --> 00:42:40.365
<00:42:36.385>So <00:42:36.618>it's, <00:42:36.851>it's <00:42:37.085>a <00:42:37.318>tough, <00:42:37.551>tough <00:42:37.785>question

832
00:42:40.385 --> 00:42:41.565
<00:42:40.385>to <00:42:40.916>answer <00:42:41.447>really.

833
00:42:42.595 --> 00:42:45.565
<00:42:42.595>Yeah, <00:42:42.794>it's <00:42:42.995>always, <00:42:43.194>uh, <00:42:43.395>really <00:42:43.595>use <00:42:43.794>case <00:42:43.995>dependent.

834
00:42:45.635 --> 00:42:49.885
<00:42:45.635>Yeah, <00:42:45.775>I, <00:42:45.915>uh, <00:42:46.055>I <00:42:46.195>also <00:42:46.335>don't <00:42:46.475>have <00:42:46.615>an <00:42:46.755>answer <00:42:46.895>for <00:42:47.035>Kareen.

835
00:42:50.265 --> 00:42:53.605
<00:42:50.265>Um, <00:42:50.440>but <00:42:50.615>I <00:42:50.790>guess <00:42:50.964>the <00:42:51.140>right <00:42:51.315>answer <00:42:51.490>is <00:42:51.665>just

836
00:42:53.625 --> 00:42:54.645
<00:42:53.625>use <00:42:53.931>Mongo <00:42:54.237>tob, <00:42:54.543>right?

837
00:42:56.035 --> 00:42:57.405
<00:42:56.035>Yeah, <00:42:56.211>I <00:42:56.387>mean <00:42:56.563>I <00:42:56.739>can <00:42:56.915>just <00:42:57.091>say <00:42:57.268>that,

838
00:42:57.545 --> 00:42:59.405
<00:42:57.545>but <00:42:57.825>the <00:42:58.105>answer <00:42:58.385>is <00:42:58.665>that, <00:42:58.945>uh,

839
00:43:00.285 --> 00:43:02.205
<00:43:00.285>databases <00:43:00.484>have <00:43:00.685>evolved <00:43:00.884>a <00:43:01.085>lot <00:43:01.285>in <00:43:01.484>the <00:43:01.685>past,

840
00:43:02.585 --> 00:43:03.645
<00:43:02.585>uh, <00:43:02.903>couple <00:43:03.221>of <00:43:03.538>decades.

841
00:43:03.905 --> 00:43:07.765
<00:43:03.905>So <00:43:04.105>there <00:43:04.305>are <00:43:04.505>really, <00:43:04.705>um, <00:43:04.905>blurring <00:43:05.105>the <00:43:05.305>lines

842
00:43:07.765 --> 00:43:09.085
<00:43:07.765>between <00:43:08.953>themselves.

843
00:43:09.345 --> 00:43:11.005
<00:43:09.345>So <00:43:09.578>you <00:43:09.811>can, <00:43:10.044>you <00:43:10.278>can <00:43:10.511>pick <00:43:10.745>any

844
00:43:11.065 --> 00:43:12.525
<00:43:11.065>and <00:43:11.284>you'll <00:43:11.503>be <00:43:11.722>happy <00:43:11.941>with <00:43:12.160>it <00:43:12.379>probably.

845
00:43:13.115 --> 00:43:15.405
<00:43:13.115>Yeah. <00:43:13.314>We <00:43:13.515>have <00:43:13.714>time <00:43:13.915>for <00:43:14.115>one <00:43:14.314>quick <00:43:14.515>question

846
00:43:15.465 --> 00:43:17.405
<00:43:15.465>and <00:43:15.620>then <00:43:15.776>we <00:43:15.931>have <00:43:16.087>to <00:43:16.242>call <00:43:16.398>it <00:43:16.553>a <00:43:16.709>day, <00:43:16.865>unfortunately.

847
00:43:17.785 --> 00:43:19.485
<00:43:17.785>Uh, <00:43:18.065>the <00:43:18.345>question <00:43:18.625>is <00:43:18.904>from <00:43:19.185>Emmanuel.

848
00:43:20.145 --> 00:43:22.805
<00:43:20.145>Uh, <00:43:20.345>are <00:43:20.545>there <00:43:20.745>easy <00:43:20.945>ways <00:43:21.145>to <00:43:21.345>handle <00:43:21.545>pagination

849
00:43:22.805 --> 00:43:24.925
<00:43:22.805>with <00:43:23.154>no <00:43:23.504>SQL <00:43:23.855>databases <00:43:24.205>efficiently?

850
00:43:26.945 --> 00:43:28.285
<00:43:26.945>Uh, <00:43:27.246>there <00:43:27.548>are <00:43:27.849>many <00:43:28.151>ways,

851
00:43:28.665 --> 00:43:32.085
<00:43:28.665>and <00:43:28.865>I <00:43:29.065>can <00:43:29.265>talk <00:43:29.465>specifically <00:43:29.665>about <00:43:29.865>document <00:43:30.065>databases.

852
00:43:32.385 --> 00:43:36.485
<00:43:32.385>Uh, <00:43:32.560>so <00:43:32.735>there <00:43:32.910>are <00:43:33.085>many <00:43:33.260>ways <00:43:33.435>to <00:43:33.610>do <00:43:33.785>that.

853
00:43:36.505 --> 00:43:37.925
<00:43:36.505>So <00:43:36.824>there <00:43:37.144>is <00:43:37.463>a <00:43:37.783>operator

854
00:43:37.925 --> 00:43:39.845
<00:43:37.925>that <00:43:38.100>is <00:43:38.275>the <00:43:38.450>dot <00:43:38.625>limit <00:43:38.800>and <00:43:38.975>the <00:43:39.150>dot <00:43:39.325>skip.

855
00:43:40.225 --> 00:43:42.405
<00:43:40.225>Uh, <00:43:40.424>so <00:43:40.625>we <00:43:40.825>can <00:43:41.025>use <00:43:41.225>these <00:43:41.424>two <00:43:41.625>operators

856
00:43:42.585 --> 00:43:45.885
<00:43:42.585>and <00:43:42.785>uh, <00:43:42.985>basically <00:43:43.185>you <00:43:43.385>can <00:43:43.585>skip <00:43:43.785>through <00:43:43.985>documents

857
00:43:45.985 --> 00:43:48.845
<00:43:45.985>and <00:43:46.125>then <00:43:46.265>you <00:43:46.405>can <00:43:46.545>take <00:43:46.685>just <00:43:46.825>10 <00:43:46.965>documents <00:43:47.105>that <00:43:47.245>you <00:43:47.385>need.

858
00:43:49.305 --> 00:43:50.765
<00:43:49.305>So <00:43:49.492>if <00:43:49.680>you <00:43:49.868>have <00:43:50.055>a <00:43:50.243>list <00:43:50.431>of <00:43:50.618>products

859
00:43:50.785 --> 00:43:52.445
<00:43:50.785>and <00:43:51.134>then <00:43:51.484>you <00:43:51.835>skip <00:43:52.185>10,

860
00:43:52.475 --> 00:43:55.085
<00:43:52.475>this <00:43:52.630>is <00:43:52.786>gonna <00:43:52.941>give <00:43:53.097>you <00:43:53.252>the <00:43:53.408>second <00:43:53.563>page, <00:43:53.719>for <00:43:53.875>example.

861
00:43:55.265 --> 00:43:57.525
<00:43:55.265>Mm-hmm. <00:43:55.440>And <00:43:55.615>you <00:43:55.790>can <00:43:55.964>just <00:43:56.140>say <00:43:56.315>limits <00:43:56.490>to <00:43:56.665>10,

862
00:43:57.555 --> 00:43:59.725
<00:43:57.555>this <00:43:57.754>is <00:43:57.955>gonna <00:43:58.154>give <00:43:58.355>you <00:43:58.555>like <00:43:58.754>10 <00:43:58.955>documents.

863
00:44:00.545 --> 00:44:04.645
<00:44:00.545>Um, <00:44:00.720>so <00:44:00.895>you <00:44:01.070>can <00:44:01.245>build <00:44:01.420>simple <00:44:01.595>pagination <00:44:01.770>with <00:44:01.945>that.

864
00:44:05.665 --> 00:44:08.845
<00:44:05.665>Um, <00:44:05.792>but <00:44:05.919>I <00:44:06.046>guess <00:44:06.174>it's <00:44:06.301>dependent <00:44:06.428>on <00:44:06.555>the <00:44:06.683>database <00:44:06.810>that <00:44:06.937>you <00:44:07.065>use.

865
00:44:09.145 --> 00:44:11.605
<00:44:09.145>So <00:44:09.285>this <00:44:09.425>is <00:44:09.565>a <00:44:09.705>very, <00:44:09.845>very <00:44:09.985>simple <00:44:10.125>way <00:44:10.265>to <00:44:10.405>do <00:44:10.545>that.

866
00:44:12.025 --> 00:44:14.695
<00:44:12.025>Um, <00:44:12.258>which <00:44:12.491>one <00:44:12.725>would <00:44:12.958>you <00:44:13.191>be <00:44:13.425>again?

867
00:44:14.795 --> 00:44:17.135
<00:44:14.795>But <00:44:15.028>that's <00:44:15.261>what <00:44:15.495>they <00:44:15.728>can <00:44:15.961>talk <00:44:16.195>about.

868
00:44:19.085 --> 00:44:22.935
<00:44:19.085>Okay. <00:44:19.285>Well <00:44:19.485>thanks <00:44:19.685>a <00:44:19.885>lot <00:44:20.085>Stan, <00:44:20.285>Mira, <00:44:20.485>uh,

869
00:44:23.025 --> 00:44:27.095
<00:44:23.025>there <00:44:23.141>are <00:44:23.258>a <00:44:23.375>few <00:44:23.491>more <00:44:23.608>questions <00:44:23.725>in <00:44:23.841>the <00:44:23.958>QA <00:44:24.075>tab <00:44:24.191>on <00:44:24.308>your <00:44:24.425>event,

870
00:44:27.435 --> 00:44:28.495
<00:44:27.435>uh, <00:44:28.389>page.

871
00:44:28.875 --> 00:44:31.055
<00:44:28.875>So, <00:44:29.050>uh, <00:44:29.225>if <00:44:29.400>you <00:44:29.575>have <00:44:29.750>some <00:44:29.925>time <00:44:30.100>left, <00:44:30.275>uh,

872
00:44:31.135 --> 00:44:34.325
<00:44:31.135>would <00:44:31.310>you <00:44:31.485>mind <00:44:31.660>entering <00:44:31.835>entering <00:44:32.010>them <00:44:32.185>in <00:44:32.360>chat <00:44:32.535>please?

873
00:44:34.505 --> 00:44:36.845
<00:44:34.505>Oh, <00:44:34.785>not, <00:44:35.065>yeah, <00:44:35.345>sure. <00:44:35.625>Okay, <00:44:35.905>great.

874
00:44:36.995 --> 00:44:40.805
<00:44:36.995>Well <00:44:37.111>let's, <00:44:37.228>uh, <00:44:37.345>well <00:44:37.461>I'm <00:44:37.578>sorry <00:44:37.694>to, <00:44:37.811>uh, <00:44:37.928>have <00:44:38.045>to <00:44:38.161>let <00:44:38.278>you <00:44:38.395>go

875
00:44:41.005 --> 00:44:42.725
<00:44:41.005>'cause <00:44:41.145>I've <00:44:41.285>been <00:44:41.425>having <00:44:41.565>a <00:44:41.705>good <00:44:41.845>time <00:44:41.985>and <00:44:42.125>learned <00:44:42.265>a <00:44:42.405>lot.

876
00:44:42.785 --> 00:44:45.285
<00:44:42.785>So <00:44:42.912>thanks <00:44:43.039>a <00:44:43.166>lot <00:44:43.294>and <00:44:43.421>hope <00:44:43.548>to <00:44:43.675>see <00:44:43.803>you <00:44:43.930>again <00:44:44.057>soon. <00:44:44.185>Bye-bye.

877
00:44:45.615 --> 00:44:46.045
<00:44:45.615>Thank <00:44:46.002>you.