1 00:00:00,820 --> 00:00:11,259 ok well I was making the mistake with the law the problem was after looking at it all and 2 00:00:11,259 --> 00:00:17,679 going back half crazy is that we were missing here I had not put the two points here ok then 3 00:00:17,679 --> 00:00:23,079 when the leader passed him if I did not pass these two points he did not recognize it as the parameter 4 00:00:23,079 --> 00:00:30,760 then I was not saying that I did not find that route with the subject of the update 5 00:00:30,760 --> 00:00:44,179 you also have to pass it we are going to pass those two that there is worth it and now it works for me if we are 6 00:00:44,179 --> 00:00:59,200 in our database I see that there is no document in user I have the user of miguel ok 7 00:01:00,780 --> 00:01:07,280 we are going to create ourselves or we are logged we are going to start launching different 8 00:01:07,280 --> 00:01:17,420 petitions is worth then the first is to create a consultation a new task a new task 9 00:01:17,420 --> 00:01:29,549 then I am going to put the post we are going to put the task here and I am going to tell it that the title is task 1 10 00:01:29,549 --> 00:01:38,170 and this is a task 1 test ok this I give it to sense ok it creates the task if we look we are going to 11 00:01:38,170 --> 00:01:44,209 copy the idea of ​​the task that is this 12 00:01:44,209 --> 00:01:52,829 worth that ends in 4 c control is worth in tasks and we will have created it here 13 00:01:52,829 --> 00:01:58,049 we have it if we look for now in what 14 00:01:58,049 --> 00:02:01,650 we look for all the tasks 15 00:02:01,930 --> 00:02:09,210 all the tasks of miguel is worth right now I only have this one but it already gives me 16 00:02:09,210 --> 00:02:17,669 as I was not doing it well, it is worth if we look for only the task with that and it will also give it to me 17 00:02:18,889 --> 00:02:24,689 , it is worth only this one that I only have that one, but it is no longer working and if what I want 18 00:02:24,689 --> 00:02:33,030 is to delete that task then I am going to pass the law the task of the ip that is the idea 19 00:02:33,030 --> 00:02:42,030 I give it to be a erased task, now it is already fine and it was for the two points this is good 20 00:02:42,030 --> 00:02:53,479 because it would be and the law no longer works now we are going to the update we are missing the update then 21 00:02:53,479 --> 00:03:01,139 let's go to our fichero to the controller the controller and in the update what we are going to do is 22 00:03:04,400 --> 00:03:11,259 as well as until now, it is worth if always constant tasks is equal to 23 00:03:11,259 --> 00:03:16,520 these points fine 24 00:03:16,520 --> 00:03:25,659 go there and it is worth finding the air and updating it is worth and this is going to take us the 25 00:03:25,659 --> 00:03:30,580 network point params point and d 26 00:03:30,580 --> 00:03:41,439 ok and we are going to tell him ok because this one does receive more input parameters 27 00:03:41,439 --> 00:03:50,319 the update is first is what document we want to modify ok that is the one I take for the 28 00:03:50,319 --> 00:03:59,680 and then it is that in the field I want to update it is worth that we are going to take it by the 29 00:03:59,680 --> 00:04:08,340 body network is worth and second and third sorry when we are working with mongo db when 30 00:04:08,340 --> 00:04:15,759 an update is made in memory the document remains without the update even if it is 31 00:04:15,759 --> 00:04:21,519 updated, it is worth then to update it you have to pass it a third parameter 32 00:04:23,180 --> 00:04:32,379 which is an option, it is worth that it is mine the new one and you put it to true, it is worth that way it will always 33 00:04:32,379 --> 00:04:42,759 show you the last one, it is worth here as we have said before we say if there is no task, that is, there is some 34 00:04:42,759 --> 00:04:47,079 type of problem you are going to do a returnt 35 00:04:47,079 --> 00:04:53,439 res.status 404 36 00:04:53,439 --> 00:04:58,519 json json 37 00:05:03,660 --> 00:05:07,160 two points 38 00:05:07,160 --> 00:05:15,790 the same task not found is worth and 39 00:05:15,790 --> 00:05:24,490 If everything is fine, then what we are going to do is a res json that sends us the front, the task, okay? 40 00:05:25,670 --> 00:05:31,209 And there we would already see it updated because we have put the new to true. 41 00:05:31,290 --> 00:05:35,629 If we don't pass this third parameter, then it will visualize the old one, okay? 42 00:05:35,649 --> 00:05:36,850 And that's what I don't want. 43 00:05:37,329 --> 00:05:38,389 Okay, let's try it. 44 00:05:38,389 --> 00:05:47,290 then we are going to create a new task because we have already deleted the other one, I come here, 45 00:05:49,290 --> 00:06:00,870 I am going to remove it, we are going to put a post, we are going to create a new task that is title 1, we are going to put it 46 00:06:00,870 --> 00:06:08,189 because title 1 this is a test, we already have it created if we come to the database we have it 47 00:06:08,189 --> 00:06:21,069 has not just created it, we are going to take that idea and that task control c we are going to put the put 48 00:06:22,470 --> 00:06:33,410 we are going to pass it that there is another light and I am going to tell it the field that I want to modify the key 49 00:06:33,410 --> 00:06:40,170 value that I want to modify, which in this case is going to be 50 00:06:40,170 --> 00:06:49,029 we are going to put the title to instead of task 1 we are going to change it to 51 00:06:50,730 --> 00:06:58,540 example class 52 00:06:58,540 --> 00:07:02,920 ok ok this I send it 53 00:07:02,920 --> 00:07:31,300 ok, this has given me a problem in the json, let's see if it has come to us to modify it, where are you here, 54 00:07:31,300 --> 00:07:48,110 controller, add day, receive start, return res status, 404.json, task, task, 55 00:07:54,899 --> 00:08:19,399 And this one we have put as PUT, here we have put PUT task, bar id, this is fine, localhost 4000 villablanca don tareas task, the id, we put the PUT, title, example, class 1. 56 00:08:19,399 --> 00:08:37,740 This is the user and this is the ID of this document 57 00:08:37,740 --> 00:08:45,820 we are connected 58 00:08:45,820 --> 00:08:49,960 everything is fine 59 00:08:51,559 --> 00:08:55,679 control v that is fine and if we give the send 60 00:08:55,679 --> 00:08:58,440 it gives us the error 61 00:08:58,440 --> 00:09:02,440 the connection was rejected by the server 62 00:09:02,440 --> 00:09:09,240 let's see 63 00:09:09,240 --> 00:09:12,240 let's see if it's because I'm missing here 64 00:09:12,240 --> 00:09:20,240 in the web then we are in our consultation 65 00:09:20,240 --> 00:09:29,340 we have the idea of ​​put now yes now the title has changed to 66 00:09:29,340 --> 00:09:35,539 example class is no longer title 1 if we want to change the description 67 00:09:48,070 --> 00:10:03,080 This is the example of the class that we are doing the video and we would already have all the 68 00:10:03,080 --> 00:10:10,940 CRUD operations that can be done on MongoDB. Well, in principle we would already have our 69 00:10:10,940 --> 00:10:16,879 backend, we would already have our API with its endpoints and we could connect to it and start 70 00:10:16,879 --> 00:10:23,759 to work, okay, because there is also the network, it receives us, it sends us well from the client to the 71 00:10:23,759 --> 00:10:31,580 server and from the server to the client, all the json, okay, it would be now, man, we have this 72 00:10:31,580 --> 00:10:37,759 folder that is from the schemes that we have not used, then this is to do more validations 73 00:10:37,759 --> 00:10:45,139 in the end we are all the time sending and receiving data in addition to being seeing that the issue 74 00:10:45,139 --> 00:10:48,899 of authentication, which is very important, 75 00:10:51,320 --> 00:10:58,620 okay, what we are going to put is more validation rules, okay, and I'll leave that 76 00:10:58,620 --> 00:11:03,399 for the next video, a greeting, see you later