1 00:00:02,220 --> 00:00:10,470 Now that we had a look at a couple of operators that work nice with numbers or with changing the 2 00:00:10,470 --> 00:00:12,410 values of fields in general, 3 00:00:12,610 --> 00:00:17,320 let's have a look at some operators that work with the field itself. 4 00:00:18,010 --> 00:00:28,510 For that again, let's look into our data and let's say we want to drop the phone value on all persons who 5 00:00:28,510 --> 00:00:29,590 are sporty. 6 00:00:29,880 --> 00:00:34,390 So for this, we can again reach out to our users, update 7 00:00:34,390 --> 00:00:36,080 many users here 8 00:00:36,490 --> 00:00:39,030 and then check if isSporty is true, 9 00:00:39,040 --> 00:00:40,370 that is our condition 10 00:00:40,510 --> 00:00:42,110 and then here is what I want to change, 11 00:00:42,160 --> 00:00:45,550 I want to drop the phone value. 12 00:00:45,580 --> 00:00:54,270 Now one thing you could do is you could set phone to null, if you do that, it updated three elements and 13 00:00:54,280 --> 00:01:02,070 if you now look into your data, you'll see phone is null for everyone except Manuel who is not sporty. 14 00:01:02,720 --> 00:01:03,450 Now 15 00:01:03,460 --> 00:01:04,740 null is not 16 00:01:04,780 --> 00:01:11,450 not that though, drop does mean the field should not be there anymore but it is there, it's just null, 17 00:01:11,680 --> 00:01:14,470 so this is not the perfect solution. 18 00:01:14,470 --> 00:01:21,880 There is a special operator you can use to really get rid of a field though and that is the unset operator, 19 00:01:22,510 --> 00:01:27,910 unset allows you to well unset a field, get rid of a field. Here 20 00:01:27,920 --> 00:01:34,960 the syntax is such that you add a document as a value and then here I want to unset phone and the value 21 00:01:34,960 --> 00:01:38,420 you specify here is totally up to you. 22 00:01:38,500 --> 00:01:42,140 Typically you use an empty string but this will basically be ignored, 23 00:01:42,160 --> 00:01:48,610 the important part is the field name here and that you used unset before. If you now hit enter, three documents 24 00:01:48,610 --> 00:01:49,620 were affected 25 00:01:49,750 --> 00:01:53,290 and if we have a look into our data, there is no phone on Chris, 26 00:01:53,350 --> 00:01:55,200 there is no phone on Anna, 27 00:01:55,330 --> 00:02:00,090 there still is a phone on Manuel but Max's phone number was also dropped. 28 00:02:00,100 --> 00:02:02,220 So this is the unset operator.