1 00:00:02,150 --> 00:00:07,780 Now before we continue with other operators, one more word about $set, 2 00:00:07,880 --> 00:00:12,300 I only used it to change one field at a time. 3 00:00:12,320 --> 00:00:14,450 Now Chris can still need some work, 4 00:00:14,450 --> 00:00:17,490 we can add a phone number and an age, 5 00:00:17,540 --> 00:00:23,350 so again I will take the objectId of Chris and then I will use update one again 6 00:00:23,360 --> 00:00:29,520 and of course by the way, I could also use update many even if I know only one document will be affected 7 00:00:29,990 --> 00:00:32,800 but update one is clearer about my intention 8 00:00:32,960 --> 00:00:34,610 and since I filter for the ID, 9 00:00:34,730 --> 00:00:38,510 it's pretty clear that there will be only one document that matches. 10 00:00:38,600 --> 00:00:45,100 So I filter for Chris here essentially and I use $set again to describe the changes to that document 11 00:00:45,380 --> 00:00:53,440 and now here, I will actually change multiple fields, so I will set the age to let's say 40 and I will 12 00:00:53,440 --> 00:00:59,840 set the phone number to some random number, like this. If I now hit enter, 13 00:00:59,860 --> 00:01:00,520 you'll see again 14 00:01:00,520 --> 00:01:02,980 we found one document, we updated one document, 15 00:01:03,070 --> 00:01:08,380 if I have a look at all my documents, you see age and phone was added to Chris now. 16 00:01:08,740 --> 00:01:13,170 So $set is of course not limited to updating only one field, 17 00:01:13,240 --> 00:01:16,480 it can update as much as you want on the document. 18 00:01:16,480 --> 00:01:19,940 It can add arrays as you saw previously with the hobbies array, 19 00:01:19,990 --> 00:01:24,130 it can add embedded documents as you saw with documents in the array, 20 00:01:24,130 --> 00:01:27,730 of course it can also add embedded documents outside of arrays, 21 00:01:27,850 --> 00:01:30,470 so it gives you the full flexibility 22 00:01:30,520 --> 00:01:38,540 you also have in your inserting documents, just that it either adds a field or simply, well edits it.