1 00:00:02,290 --> 00:00:06,910 Let's go back to our flight data, let's quickly find all the flights here, 2 00:00:06,910 --> 00:00:08,190 this is our flight data 3 00:00:08,320 --> 00:00:16,890 and now let's say we want to store the status for a flight. For this, I'll use my flight data and I'll update 4 00:00:18,190 --> 00:00:20,090 many elements, 5 00:00:20,320 --> 00:00:24,140 I'll pass an empty document as a filter to target them all 6 00:00:24,460 --> 00:00:27,090 and then here, we have $set 7 00:00:27,100 --> 00:00:29,210 and then how we want to change them 8 00:00:29,320 --> 00:00:36,160 and now let's say we want to add a status field but that status is not something like on time which 9 00:00:36,160 --> 00:00:36,930 you could use 10 00:00:37,090 --> 00:00:39,460 but let's say this is another document. 11 00:00:39,640 --> 00:00:41,950 So here another pair of curly braces, 12 00:00:41,950 --> 00:00:48,330 so this is now a value we set for status which we add to our flight data. 13 00:00:48,670 --> 00:00:54,730 And now here you can enter anything which you can have in a document, multiple key value pairs, even 14 00:00:54,910 --> 00:00:57,250 other nested documents if you want. 15 00:00:57,520 --> 00:01:08,200 So here we could have a description field which is on time and maybe last updated which is one hour ago, 16 00:01:09,690 --> 00:01:11,390 if we now hit enter here, 17 00:01:11,760 --> 00:01:15,390 it updated both documents because we had no filter 18 00:01:15,390 --> 00:01:24,030 and if I now output my flight data in a pretty way, we see these nested documents here and this is what's 19 00:01:24,030 --> 00:01:25,630 called embedded document, 20 00:01:25,710 --> 00:01:28,940 I use nested and embedded interchangeably here. 21 00:01:29,010 --> 00:01:30,960 So this is an embedded document, 22 00:01:30,960 --> 00:01:36,110 it's another json document within a wrapping json document. 23 00:01:36,180 --> 00:01:41,340 We got two documents in the collection and each of these documents has a child document 24 00:01:41,340 --> 00:01:46,550 and as I said, inside of the status, you could have another nested document. 25 00:01:46,560 --> 00:01:56,160 So if I would repeat my command here and add another value with maybe details, that could be another 26 00:01:56,370 --> 00:02:04,580 nested document, so another pair of curly braces, maybe this has a responsible field and there, I put my name 27 00:02:04,580 --> 00:02:05,260 in there. 28 00:02:06,440 --> 00:02:09,600 If I now hit enter and I output all the flights again, 29 00:02:09,680 --> 00:02:12,530 now we see another nested document in there, 30 00:02:12,650 --> 00:02:18,770 so a nested document or an embedded document in an embedded document in a collection document. 31 00:02:18,770 --> 00:02:21,250 So these are embedded documents 32 00:02:21,560 --> 00:02:24,270 and now we also can have arrays of data. 33 00:02:24,290 --> 00:02:26,130 Let's have a look at that in the next lecture.