CRUD operations in Mongodb using Node JS and Postman tutorial - POST UPDATE FETCH DELETE | REST API

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey hello everyone in this video i will be showing you how to create a rest api by using node.js and mongodb along with postman so i'll be showing you how to do post put fetch and delete operations or the crud operations so let's get started first thing let me just go and create a folder over here so new folder let me name it as nmp okay something node mongo and postman so that's it that's the folder name and i will just go to visual studio code and open that folder select folder so this is our folder opened over here so just click it and let's just name main.js okay so this is going to be our only js file that we're going to use and now we are good to go we need to install two packages okay one is express and another one is mongoose okay so for that what we need to do is we'll just right click it and just click this open in integrated terminal so which automatically gives the terminal to this path itself okay this folder itself so as i told you earlier we need express and mongoose so just do npm i express space mongoose okay and hit enter just wait till it's get downloaded so once our packages has been installed we are now good to code okay so let's get started so first is we need to import express and mongoose just a default code over here so it's going to be const express equal to require express okay within double quotes and next is const app equal to express okay that's it we are done with express now we need to include mongoose so it's going to be const mongoose equal to require mongoose within double quotes and here we also need to include app dot use express dot json okay as we will be passing our data in the form of json we need to include this particular thing over here and next is the important line we will be making our connection with our mongodb okay so in the next line it's going to be mongoose dot so this mongoose corresponds to this variable name okay mongoose dot connect and here we'll be specifying the url okay url or the path in which your database is present so since we are using localhost okay local mongodb we will be putting mongo db colon slash slash local host colon then it's going to be the port number which is 27017 slash and here you can specify the database name so it can be existing database or you can just create your own new database so i will put mynewdb as my database come out of this double quotes just put a comma and a curly bracket okay and here you will be putting useNewUrlParser as true so in case if you get any warnings to avoid that you can just put this and next one is use unified topology same true for it as well so it's parser left r so it's r and after doing this just come to this curly bracket at the end and just put a comma over there let's just display a message if you are connected or if you aren't connected as well so let's just catch that error so err and just an arrow function over here so if there isn't error any error that is the error is null which means that we have been successfully connected to our database so in case that we can just console log connected to db okay this will be the message when we aren't having any error and let's suppose say that we are having any error that means the else block will be executed so let's just copy this and paste it and let's put error that's it so this is the connection over here connecting our database so next is let's just run start our server okay then we can just do the rest of stuff okay so it's going to be app dot listen the port i will keep the port as 3000 and just an arrow function over here i will just console log on port 3000 just save it okay i think we are good to go just have a comment over here db connection okay save it now and let's just go to the terminal and it's going to be node your filename.js my filename is main just hit enter over here so now we are getting on port 3000 and we are also getting connected to db which means that there isn't any error so err is null so this is getting displayed that's really well and good let's just stop this control c and now let's just create the schema okay schema for our mongodb database so i'll just type in the entire thing in the same file okay it's just going to be like 20 lines of code i don't want to have like multiple number of files and like make it really confusing i will just keep it as simple as possible so here i just going to create the schema okay and it's going to be const sch be my schema name okay and i will be having just two values okay let's say i will have a name is going to be of data type string and i will also have an email okay just demo purpose i will just have email that is also going to be of type string as well so in case like if you also want a id going to be of type number just hit number over here okay so once you are done with your schema you need to just attach your schema with the mongoose model so it's going to be const mongoose model okay equal to mongoose that is this variable name over here this name that you have specified that's this variable name mongoose dot to put model and here you need to pass that collection name collection name is like the table name that you're going to have in your mongo database so collection is nothing but a table like in sql we call it as table and in mongodb we call this collection so be really careful over there i will name my table or collection name as newcol something and next you will just put a comma and here we will pass this schema name so it's going to be sch over here so that's it we're done with our schema this and we are also done with our model over here so next thing is we need to just create a post request okay code for the post request so it's going to be i'll just put post route you can say it as post route or post route and here we are not going to use any router we're just going to make use with the help of app.post itself so app dot means this app okay this name that you have specified over here so it's going to be app.post okay there are actually many requests post delete get but here we're just going to like push data or input data so here we're just going to use post and here we'll pass the url okay so it's going to be for me just post so this will be like localhost and colon port number slash post so that's going to be the entire url for this and it's just put a comma outside the double quotes is going to be async and we'll just have a bracket and inside that we will have the request and response and just put a arrow function over here inside this so everything should be like inside this enclosed within this app.post itself so after this what we'll do is we'll just have a console okay console.log and we'll just pass the message inside post function okay just as a notification whether like whether this particular app.post is getting called or not so just to verify that and next thing what we'll do is we'll just have a variable okay data so this const data is used to extract the data that we are passing to this url okay so we are going to post data so we need to have some input so that input we are going to feed it with the help of postman okay so with this help of this url we will be entering this localhost slash post url over here and we will also enter this key value pair so this is where we are going to get the input so our input will be sent to this like url and data that is posted over here will be collected in this variable data okay so how we are going to do that is we are just going to have a new and we are going to use this mon model okay this thing that's just a model mongoose model and what we will do is open circular bracket and a curly bracket over here going to be name dot so name corresponds to this variable name over here okay so it's going to be name req dot body dot name okay so req refers to this one okay you just highlight this okay and just put a comma and it's going to be email req dot body dot email okay email corresponds to this thing another variable okay and next thing we also have id so it should be id and just copy paste this stuff over here copy it let's paste it just have it as an id okay this all this data will come from this postman we will be just pushing all this data from here and we'll get to this url and from by using this method we will just segregate and store it as name email and id so this things request.body corresponds to json body that we are sending it from our postman so once all these values are getting stored in our data we need to just store this data in our mongodb collection so for that what we will do is just come over here const val okay this is something a shortcut for value equal to await data corresponds to this data okay consists of name email and id data dot save so this line of code basically saves the data that is our name email and id that is passed from our postman and it just saves it in our collection okay and next thing is response we will just send this data okay response dot json you'll just send val so val will also contain the same data that is present in our data variable and response dot data means this will send back to our postman just it's just considered as a message okay we are sending data from our postman to this url and just getting stored in our mongodb database after all it's done the same data will be sent back to our postman again as a response so that's what this res.json value means okay over here i think we are good to go okay so this is post we have done with our data everything we have done our schema model so let me just save it and we just run it again in node and i hope it works so we're on port 3000 and we're also connected to database and i will just now go to database and check whether you're having a database named it's mynewdb okay so if i just go to over here and if you just refresh it so as you can see here we are getting mynewdb over here and just click here i'll be i'm having a collection so this is the collection name that i told you earlier that's similar to a table in mongodb so it's named as newcols and how we are getting the name is that it's from here newcol i specified it as newcol it will automatically add a s to it at the end okay so that's by default so now our database and our collection has been like created over here so next the final thing we need to post data okay so we will be using postman okay like i guess you know this tool so what you do is just close it just go to this plus icon over here open it and here you to enter the url so so it's going to be http colon i'm already having like auto complete over here so this is like the url that we are having over here so it's http okay if you do http s i think you will be getting an error do http colon you'll be really careful over here and this 3000 is corresponding to this 3000 okay if you have given some other value here make sure that you change over here as well so it's going to be slash post and this slash post is this url okay so corresponding you'll make use of this post function okay so here we need to pass three values okay so it's going to be a post request so we'll just go here and put post and just go to body will be not having any space to input so we need to go to raw and instead of text you need to change it as json because we are going to input in the form of json okay so i know you know the json structure it's going to be like a key value pairs so i think our first name is name email id so it's going to be name colon and abc i'll just have the name as abc another important thing is that your name email like the key should also be within double quotes okay name email i will just put abc at abc.com comma and our id colon let's say one two three four five okay since our id is of number type there isn't any requirement of double quotes but abc these are of type string because we have specified over here as string over here so that's good i guess so let me just now send okay so we're having three values so if I just put send so we are getting this back okay so that's the thing i told you earlier we are sending it and we're getting this as a response back so the reason we are getting the same value but we are also having a id as well as a version this is called as version i guess as zero because of this single line okay here i will explain to you later okay first let's check whether we have got our value okay so now i will just go to our mongodb and this is our collection newcols if i just now hit refresh i will be getting these values abc abc at abc.com and one two three four five it's absolutely fine we have just posted data in our mongodb and coming back to the response okay and we will be having like two additional what to say additional key okay we are having id and we just passed this three over here this id is like a primary key what do you call in SQL it's called the primary key which is like uniquely used to identify a particular row okay so this id is automatically generated by mongodb and this version v is like obviously also auto generated you can also like have some code to avoid this as well you can try that as well and we are getting this as a response back to our postman okay and that is because of this line okay as I told you res.json(val) is because this val will contain all these entire thing okay and let's suppose that we don't want to send that json we can send something as well like response dot send and just put posted okay save it and you can also see that inside post function that's because this function has been like called by this postman we are just calling it's like function calls we are just making use of this function so that's why i'm getting this inside post function okay so let me just know stop it ctrl c okay to stop and i'll just run it again so this time i will just post some other data i will put only ab over here and one just send it so this time I am getting posted okay and the reason is obvious i think you know because I haved just changed from res.send json so i'm sending it now res.send posted and if i just now go to my mongodb and if i just refresh it i will be getting the new value over and now let's jump into our update okay so first i will just go here and i'll put operation over here so it's going to be like a very very similar code okay but the difference is that here we will be pushing all the data in the request body itself but in the put or the update operation we will be getting that id through the params okay through this parameter okay i will also show that to you okay so first let's begin with the code okay it's going to be app dot put okay and next is our url over here okay so it's going to be i'll just put slash update slash and next thing as i told you that you will be getting the id in the form of a parameter from the url itself so it's going to be colon id so we will be with the help of this id we will be updating the particular data okay and it's going to be comma async and the regular thing is going to be request comma response over here and arrow function and curly bracket okay that's it so next thing we need to have access to this id value okay but here we use request.body to get the value and here you will be using request dot params okay so let me just put let my updating id i'll just call it as upid over here equal to request dot params we'll be having this params which directly corresponds to this getting fetching value from this url dot id so this id corresponds to this one over here that's why i've given a colon which means that we can access it through the this params keyword so it's going to be like this so i'll just copy this and i will just go to my postman and if i just go to put okay and instead of slash post we'll be putting slash update and here I will pass some id let's say it is going to be one and in the json we will be not passing our id okay because we are getting the id from our url itself so why need to pass id over here so i will just remove this we will be passing the name and email which is to be updated and we will be passing the id of that particular name and email in the parameter okay really simple i guess so now we need to also have this name and email value right so for that what we will do is just copy this paste it and instead of this upid i will put update name and instead of this params it's going to be body and for id is going to be name okay so just copy this paste it over here it's going to be upemail and here i will be putting email okay and the really important thing over is that here i am using params and here i am using body so this is quite similar to the post operation where i have used body as well so i think the reason is obvious this params corresponds to this url and this corresponds to the request body so that's why i am fetching the id from the url and i am getting the name and email from the body so that's the reason why i'm using params and body over here so now let's just jump into the main update operation okay so for updating anything we will be having like two steps okay the first one is going to be we need to find that particular id you need to first check whether that particular data that we're trying to update is like initially present and the second operation is obvious just update it okay so these are the two things that everyone does but we can do the two things with the help of a single function itself the function name is find one and update okay so for that first what you need to have is you need to have that model name okay so this is the model that i have created over here it's mon model okay so you need to have that model name so just copy your model name and just come inside this function paste it dot you need to have find one and update so this is the function over here just click it so this will take like i guess four parameters or four arguments really you need to be really careful over here so the first argument is going to be the id for which we want to update the data so it's going to be just open curly bracket and just pass id colon and upid okay so basically this id corresponds to that value this id okay corresponds to this id and this upid corresponds to the id that we are passing as the parameter over here okay i hope that made sense and this is going to be the first parameter and the next parameter is going to contain all the values that we want to change or update so next thing is going to be again open curly bracket dollar set colon open curly bracket next thing is going to be name colon upname comma email colon upemail okay name and email corresponds to the key present in this database and this upname and upemail it's obvious it's the data that we are passing from our postman okay this is going to be our second argument and you need to be careful just come out of it put a comma over here and you're going to put new colon true okay i will explain it to you why we are putting new colon at the end okay now just put a comma over here and open circular bracket here it's going to be error comma data okay really simple if any error is going to come this error will catch that and this is going to be our data okay so after this just arrow function and just open curly bracket okay so if you can't view this what i will do is i will just okay so this is going to be like a continuation from that you can just also type it so i think now it's perfectly visible over here so now we are just going to have a simple if condition okay and this function finds and updates okay so it's basically performing two operations so now let's have two conditions okay our first condition is going to be here having data of id one two and three so what if i go to postman and put four okay update slash four so this four isn't going to be present in our database itself so in that case our data value will be null okay so for that we will do if data equal to null okay that is our id is in present okay we will just put response dot send we can just put nothing found okay and our second condition is going to be obvious if our id is present and the data is also present in that case it will automatically update that particular value with the required name and email so in that case in that case we'll be putting a yells operation and we will put response dot send our data so we will be viewing this data in the postman it will be coming over here okay so that's the meaning for that so now let's just run and test it out okay i think we are pretty much done over here let's run and see it now so i'm just saving it and i'm just stopping it now and just restarting it again so it's on port 3000 i will just go to my postman and first i will check what are the ids that i present so 4 is not present uh like as i told you earlier so now i'll just put update 4 and let my name be something okay i will just put uh that one will not be my name and it be my email okay something so i am putting four so we need to get uh respond dot send nothing phone should be present coming inside the console over here so i will just send it now so as you can see i'm getting nothing found which is absolutely right and we are having this b okay okay i will do a itself so we are having this id one and having name as a email as ada.com so i will now just change this values okay so for that really simple just go over here and put one i will just pass this one itself for all so i will just send it and i'm getting this as a response over here the reason is this line is being sent it automatically updates it and sends the response the data over here and we are getting this over in our postman so now if i just go to my mongodb it will be the same okay but if i just refresh this watch over here just refresh it i'll be having one on one over here that's it we have successfully performed our update operation another thing as uh i wanted to mention is that i told you i will explain you why we are putting this new rule right so if i just put new as false i'm putting this new and false okay and i'm just saving it i'll just stop it so we got the updated data right we got the updated data in our postman over here so it was earlier yeah yeah yes the name and c a yeah dot com something which with the id one but we are getting the updated value in the controller for postmate so what if we wanted the existing data over here so in place of one one one we wanted a and we wanted a da.com the existing value that was present before our update and operation so in that case we will be putting new as false over here so now let me just restart it node would mean so same thing it's running now so now as you can see here we are getting having this value and i will just update the same thing i will put one as the id and instead of all ones i will put all 2's over here all 2's over here as well and now if i just send it i'll be getting this same data over here so if i just send it now so i'm getting the same data over here but in my mongodb database if i just refresh it it will be updated but i'm still getting the whole data so i hope that made sense to you if you put new equal to true over here we will be getting the updated data as the response over here and if you put new equal to false over here we will be getting the data before updation that is the old data or the previous data okay i hope that that was clear to you and now let me just put it uh to true okay we'll just put it through and i will just stop this and the final thing that we are left with we did it we didn't even use this error okay it's really important you do error handling so if i just put if just put if the error and i will just have response dot send i will just put error okay and i will have a if if block or ls block over here and just close it and put this entire e files block within that else block okay so if you are getting error we will be getting only this as a response and this won't be even executed so now i hope this works i will just save it and i will just run it again and i will just go over here so i'll just put the same thing i'll put three over here three over here so i'm putting name and email you can just give a proper name and i'm just going with the numbers between that so we just write now so i'm getting the updated one and so how to get an error okay so i need to get response from the error over here so let me try this way instead of one uh i will put a okay so i'll just send it now so i'm getting an error okay so this is being sent because we have given the id as a number i guess so as id is a number so we can't pass a character or string over there so that's it i guess we have successfully covered put operation so now let's go and do that get our fetch method okay so let me just come down over here i will just put a command as fetch or get something like that the next thing it's going to be ab dot get and inside the bracket we need to specify the path okay so it's going to be slash fetch and we are going to fetch with the help of id okay so it's going to be colon id so this id basically corresponds to that this id okay not the default id of mongoose but our one specified id over here so that's going to be the id that that id we are going to pass through the parameter and just come out of this path comma function so it's going to be request and response over here just open curly bracket and first thing we need to get this id okay so for that i'll just put fetch id equal to request dot params dot id okay that's it so if you are getting some data from through request body we will put request.body and if you are getting that id from a parameter we will put request.params.id and next thing is to fetch the data from the mongoose database we will be using the find function okay so in the next line you need to specify your mongo's model name so in my case the mongoose model name is bond model okay so just come down over here and put mon model dot find okay and just open circular bracket and inside this you're going to pass like two parameters okay first one is the id through which you want to find in your database so just open another circular bracket just pass id over here so this id as i told you there corresponds to this id okay if you want to find with help of name you can give name there email there okay i am finding with the true id itself okay so i am putting id over here and id i am going to pass the value that we are passing through our parameter so it's going to be fetch id over here and this needs to be enclosed within curly bracket as well okay just put a curly bracket over here and come out of this stuff okay come out of all of this okay this is going to be a second argument comma function open circular bracket again and error comma value okay and open curly bracket again so in case of any error this catches it and the value this value corresponds to that values that are present in the database for this corresponding id that we are passing over here so what we are going to do with this data is let's just send it okay let's just do response dot send val that's it okay this response of send value means that this value okay the values present in the database will be getting displayed in our console of our postman basically it will be appearing here so now let's just run and test it out okay save it and just run it now so it's on port 3000 i will go to postman so it's slash fetch slash and what are the ids we are having i'm having three okay i will put id three okay it's going to be slash three so this is what that path means slash fifth slash three means that slash fetch slash three so this three will be getting passed as fetch id over here and another important thing is that you need to change this to get to okay uh it won't work if you keep as post or some other thing so we don't need any data to be passed okay none that's perfect i guess and if i just now send this i'll be getting all these values so as you can see i'm getting name as d email dfd.com something and the same data is also present in the database okay and just have a look at it and let's suppose that if you pass something okay uh some other id that is impressive in your database let's say i will put some thousand thousand is not present in my database itself so if i just now send it i'll be getting an empty array with okay i'll be getting empty array so in order to like uh make our code more understandable and generic we will have some conditions okay to check this as well to check whether our particular id is present in our database or not so for that it's really really simple so first thing let me just remove this if val dot length okay equal to zero okay which means that our val is this empty array okay we will be getting this empty array when we pass a id which it is in present in our database as in case we pass thousand right we are getting an empty array so we are checking that and if this val dot length is equal to zero what we will do is we will put response dot send okay data does not exist okay or you can do wrong id something like that else means our data is present okay you will just put a yellow state response dot send well the value okay and we are also having this error okay this error is unused really important to use this as well so for that just come top of this if error if there is any error that becomes this if condition becomes true and this get executed so just come over here you can just have a response dot send and just just pass something error something like that random thing or you can just pass that error over here as well that's your choice and after having this error you need to put a else condition okay else condition i need to enclose all these previously written code within this okay just okay like this so this ending curly bracket will be corresponding to this else block okay so it's pretty obvious if you have any error means this code isn't going to work so we need to just have it in else part okay and i think this makes sense to you so let me just now save it and stop the existing one and rerun it again so it's working well so now if i just say the same thing thousand it is impressive in mongodb database if i just send it now i'll be getting data does not exist and i will go here 11 is present in my database so i will just put over here 11 and send it i'll be getting the value okay and in case of error okay for error i think if we will get a rare if you pass some alphabet or value so i'll put yeah something like that and if i send it i'll be getting error over here as well so this is working perfectly now let's jump into our date operation so first let me stop the server okay and i will just come down just put fetch and here it till it will come okay just put delete and i am going to delete with the help of id okay so just come to mongodb database so it is this id that i am creating and passing it is not the id that is auto generated by mongodb okay i am going to delete with help of this id okay so i'll just come over here come to the next line it's going to be app dot you'll be having the delete function over here just click it delete open circular bracket and the first parameter is going to be the path okay so i'll just open single quotes for me the path is going to be slash del okay del and colon id okay so this is how it is going to work i am going to get the id from the parameter of the url itself so let me come over here so it's going to be i'll show you a demo okay just say example it's going to be slash dell and let the id be one okay so this one is being passed as a parameter okay and we will cache that parameter and we will delete that particular data having id one okay i hope that made sense and this is fine with the path just put a comma it's going to be function same thing request comma response just come out of this and open curly bracket okay so as i told you earlier the first thing what we will do is we need to get a hold of this id cache this id okay so for that just come to the next line so it's going to be let i will put it as del id okay delete id equal to request dot params okay dot id okay so so the reason why i'm putting params is that i am getting the id from the url as a parameter okay so in case if you are getting the data from the body body means like this one okay in that case you will be using requested body but here i i'm using parameter so i'll be going with request.params.id and the next one is going to be our main function okay so here i will be using the find online delete function so for that first we need to uh have our model name okay so in this case my model name is mod model okay just a mongoose model that we have like defined after defining our schema so it's going to be mod model let me just copy this mod model okay come down and so it's only one model dot find one and it okay it's not fine won't be id it's fine and delete okay and just open bracket so it is also like two parameters one id and other is a callback function so first thing is the id okay so just open another circular bracket to be like really careful over here so for passing the id just put a curly bracket id colon my id that is i'm receiving from the parameter which is delayed okay del id so this id name corresponds to the id that i have passed or created in my database so if you have some name or email okay you need to put name and email over here it's not this i'm repeating again this it's not this auto generated id okay so after getting the id over here you need to just inside this dell from delete function just put a comma same thing it's going to be function and you have to pass two arguments over here okay one is error another one is let me just put uh dogs okay docs or data something it's absolutely your choice and come out of it just put a curly bracket okay so first let me explain this what is this error okay so this function basically just catches in case of like any error in sending the data to the database and this docs or data you can name it data as well contains the entire data which is getting rated so let's suppose say that we are passing id three okay so this docs will basically have this json okay this entire data in json it will just return it for our further user reference okay that's what this dog is going to return so first let me just go over here okay i will do response dot send okay this response dot send means that i will be sending any data or information to the postman console so it will be appearing over here okay in this place of this posted okay so i will just do dogs okay that's it i guess we are now good to go but there are still more like e-files conditions to be also applied i'll just do it within five minutes okay first let me let's just check it okay whether it's working or not so just save it now and just come over here it's node main.js it's on port 3000 so now if i just go to my postman and let's suppose that i'm going to delete this particular data with id3 okay so it has like a name as d and email sd d dot com some random text on that so i'll just go here so the path should be del ok del slash the id so this path corresponds to this one i am using till over here and the id that we are considering is three and another important thing no need of these things okay you can just go to none and you need to change this to delete okay really really important if you just have some other option like get post it won't even work really important thing like it can't be even identified this error okay so just tell it to delete and just send it so as you can see this is the data okay this is the particular json that we're deleting with the help of the id 3 okay and now if if you can go to the mongo database we will be having this particular data but if we just refresh it boom that particular data with id3 has vanished it has been removed from your database so this works well and good but there is a problem over here okay so what if i again go here and again i send a three this itself okay because id3 has been we have just now deleted id3 okay but what if i do this try to do this again so we just send it now i'll be getting nothing okay null none last response because this particular id is impressive in our mongodb database so we need to also have a condition for that so let's just go here so so the reason why nothing has been written is because our dogs this dog's thing is null okay so let us have like this if dogs equal to null and just go here and have a else block okay else block and just come down okay and we will be just putting response dot send uh wrong id or you can also put id it is id is in present in the mongodb database okay it's up to you so let me just now save it and we will restart the server yeah it's fine running now so again i will just go to the postman and again i will send the same id okay i'm sending it now so as you can see i'm getting wrong id the reason is obvious that particular id and its data it is impressive in our mongodb database and another important thing you need to also make use of this error okay here is unused okay so it's really important to do error handling as well so father it's really simple if you just pass the error inside it and you can just send something response dot send now also send the error directly itself i will just put some text okay error like that and in the else block just open curly bracket and you'll be just just enclose the entire if else okay just cut it and paste it inside okay so this is pretty much obvious because if there is any error we aren't going to get any dogs or any data over here so it's better to have it inside the else block so i think now we are good to go so let me just save it now i will just stop it and rerun it again so it's on port 3000 now so now let's just go for all cases okay so let me do put for 10 it has name sj so we just go to postman and just change the ids 10 i just send it i'll be getting the data over here and if i just now go to mongodb and refresh it i'll be getting the id remote so id 1 2 11 and 22 10 is in there and let's suppose say that i will put some other irrelevant id let me put something over here like this much big number and if i just send it i'll be getting wrong id over there and let's suppose for error okay for error i think we need to pass some alphabet okay instead of a number this id okay this id that we are passing is of type number i guess um i have defined it as a number in my schema okay so i will pass it as some character or alphabet so i'll just go to postman and if i just send it now i'll be getting error okay and let's suppose the final thing is that if you don't want to send this the data itself after deleting that particular id or the data you don't want to send the entire data to the like as a response means you can just remove this and you can just have a message as deleted that's absolutely your choice okay i will do this as a final thing okay just stopping it and re-running it again and this time we will delete id2 okay just put two over here and send it i'll be getting related this time instead of the data so this is delete okay and i hope you would have found this video useful there also and many other programming videos in c c plus plus java python sql queries as well as 3d animation using blender so that's it for this video and thanks for watching
Info
Channel: United Top Tech
Views: 8,155
Rating: undefined out of 5
Keywords: rest api crud, node js crud, rest api using nodejs mongodb, crud node js mongodb, postman rest api tutorial, node js mongodb postman tutorial, rest api tutorial, rest api in node js, node js mongodb tutorial, express js tutorial, node js tutorial, build rest api using node js
Id: rcpqKpYoQKQ
Channel Id: undefined
Length: 45min 5sec (2705 seconds)
Published: Sun May 22 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.