MongoDB and Mongoose | Creating a REST API with Node.js

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ธ.ค. 2017
  • Time to not only handle our data in the endpoints (and then let the data go into the void) but to actually add a database: MongoDB!
    Join the full MongoDB course: acad.link/mongodb
    Exclusive discount also available for our course: acad.link/nodejs
    Dive into the full Node.js REST series: academind.com/learn/node-js/b...
    Check out all our other courses: academind.com/learn/our-courses
    ----------
    MongoDB Docs: www.mongodb.com/
    Mongoose Docs: mongoosejs.com/docs/guide.html
    Source Code: github.com/academind/node-res...
    ----------
    • Go to www.academind.com and subscribe to our newsletter to stay updated and to get exclusive content & discounts
    • Follow @maxedapps and @academind_real on Twitter
    • Join our Facebook community on / academindchannel
    See you in the videos!
    ----------
    Academind is your source for online education in the areas of web development, frontend web development, backend web development, programming, coding and data science! No matter if you are looking for a tutorial, a course, a crash course, an introduction, an online tutorial or any related video, we try our best to offer you the content you are looking for. Our topics include Angular, React, Vue, Html, CSS, JavaScript, TypeScript, Redux, Nuxt.js, RxJs, Bootstrap, Laravel, Node.js, Progressive Web Apps (PWA), Ionic, React Native, Regular Expressions (RegEx), Stencil, Power BI, Amazon Web Services (AWS), Firebase or other topics, make sure to have a look at this channel or at academind.com to find the learning resource of your choice!

ความคิดเห็น • 627

  • @thierrykas1528
    @thierrykas1528 4 หลายเดือนก่อน +18

    If you're a new folk, remember to use at 24:35 ---Product.deleteOne({ _id: id })--- instead of remove and at 28:52 use ---Product.updateOne({ _id: id }, {$set: updateOps})--- instead of update, Thanks Max!

    • @sephiroLord
      @sephiroLord หลายเดือนก่อน

      Thank you Sir! much appreciated!

  • @unaisulhadi9102
    @unaisulhadi9102 3 ปีที่แล้ว +8

    3 Years later, Still this one is the best Node REST tutorial on Internet. ❤❤❤

    • @ragunath_br
      @ragunath_br 22 วันที่ผ่านมา +1

      Its still the best one I have seen too.. And its been 6 years now..

  • @hyojungyu1667
    @hyojungyu1667 3 ปีที่แล้ว +58

    For the patch request in 2021, you can simplify the code as below. ;)
    router.patch('/:id', (req, res, next) => {
    const id = req.params.id;
    Product.findByIdAndUpdate(id, { $set: req.body }, { new: true})
    .then(result => res.status(200).json(result))
    .catch(err => res.status(500).json({ error: err}))
    })

    • @izzy7402
      @izzy7402 3 ปีที่แล้ว

      helpful, thanks man

    • @matthewrideout426
      @matthewrideout426 2 ปีที่แล้ว

      great - thanks :)

    • @ganeshan56
      @ganeshan56 2 ปีที่แล้ว

      instead of set, we can also use the extend function from lodash package.

    • @dr.franxx
      @dr.franxx 2 ปีที่แล้ว

      thank you

    • @burhanali7449
      @burhanali7449 ปีที่แล้ว

      Thanks

  • @MarcosLopez-bs6xr
    @MarcosLopez-bs6xr 3 ปีที่แล้ว +1

    This is the only REST tutorial where I don't have to stress over the configuration thank you!

  • @lilithfirefly3727
    @lilithfirefly3727 4 ปีที่แล้ว +1

    really helpful thanks. I saw many other newer videos but this one is the best

  • @mikemalone4867
    @mikemalone4867 5 ปีที่แล้ว

    Fantastic work, sir! I have searched high and low for someone to explain how to write an Endpoint with Node.js without assuming that we know all of the jargon that goes along with it. Most of the time, I see examples with what looks like reserved words only to find out that they are not. I would spend hours trying to find out where the examples obtained the values from that were used in the functions etc. This is clear and easy to understand. Good code is easy to read and easy to write and you are doing just that! Thank you!

    • @academind
      @academind  5 ปีที่แล้ว +2

      Thanks a lot for your wonderful feedback Mike, it really makes me happy to read that the video was understandable and helpful :)

  • @rotrose7531
    @rotrose7531 4 ปีที่แล้ว

    Thank you very much, possibly best rest api tutorials I can find on youtube.

  • @michaeltrembovler8301
    @michaeltrembovler8301 4 ปีที่แล้ว

    The best explanation I've only listened to from anyone !!! Many thanks.

  • @jameswaring6200
    @jameswaring6200 4 ปีที่แล้ว +3

    You have a really great way of explaining things!

  • @tonhuu7132
    @tonhuu7132 4 ปีที่แล้ว +2

    Very easy to understand and explain in detail.
    Thanks Max!

    • @academind
      @academind  4 ปีที่แล้ว

      Glad it was helpful!

  • @odorlessflavorless
    @odorlessflavorless 4 ปีที่แล้ว

    You are amazing Max ! Though you have made a recent video about learning, I definitely would like you share more about learning so that the basics are solidified. Your lectures prove you have a clear grasp on the fundamentals of topics that you teach.

    • @academind
      @academind  4 ปีที่แล้ว +1

      Thank you Ananta, I might indeed release such videos from time to time in the future :)

  • @Rallek
    @Rallek 5 ปีที่แล้ว +3

    Thank you for making such incredible tutorials. You are a great teacher!

    • @academind
      @academind  5 ปีที่แล้ว +1

      So happy to read that Rallek, thank you very much for this awesome feedback!

  • @luigivampa9780
    @luigivampa9780 5 ปีที่แล้ว

    Hey Max!
    I found your course really compelling. Thank you

    • @academind
      @academind  5 ปีที่แล้ว

      Thanks a lot for your comment Luigi, happy to read that you liked the course!

  • @TheMaxik
    @TheMaxik 4 ปีที่แล้ว

    Man you are incredible. I have trouble understanding things and you explain things so well that I'm advancing on this course very fast. Thanks!!!

    • @academind
      @academind  4 ปีที่แล้ว

      Just awesome to read that, thanks a lot for your comment!

  • @dorukoktay1054
    @dorukoktay1054 5 ปีที่แล้ว +16

    Great tutorial Max you are the best!! I used async-await synax instead of then() and catch() functions and it worked. For example;
    router.patch('/:productId', async (req, res, next) => {
    const props = req.body;
    try {
    const result = await Product.update({_id: req.params.productId}, props).exec();
    console.log(result);
    res.status(200).json(result);
    } catch (e) {
    console.log(e);
    res.status(500).json(e);
    }
    });

  • @rhandect
    @rhandect 4 ปีที่แล้ว

    Thank you so much, you have helped guide me in the right direction for my project :)

  • @mikaeledebro1144
    @mikaeledebro1144 6 ปีที่แล้ว +9

    Great tutorial Max. Best teacher on YT. Just a small improvement. For the PATCH, I think this is a cleaner solution:
    const updateOps = {}
    for (const key of Object.keys(req.body)) {
    updateOps[key] = req.body[key]
    }
    This way you can keep the request simple (same as POST).

    • @alihasana2009
      @alihasana2009 6 ปีที่แล้ว +1

      Thanks Mikeal

    • @darshu62
      @darshu62 6 ปีที่แล้ว

      MAX code didnt work for me, but your code did.
      Thanks Mikael...

    •  6 ปีที่แล้ว +3

      You also can use for ... in to avoid Object.keys(req.body). so the code is:
      for (const key in req.body) {
      updateOps[key] = req.body[key];
      }

  • @harsh7809
    @harsh7809 3 ปีที่แล้ว +5

    24:26 If you are having problems with delete functionality, try this
    remove() is depreciated, you should use deleteOne()
    router.delete('/:productId', (req, res, next) => {
    id = req.params.productId;
    Product.deleteOne({ _id: id })
    .exec()
    .then(result => {
    console.log();
    if (result.deletedCount > 0) {
    res.status(200).json({ message: "Deleted Successfully" });
    } else
    res.status(500).json({ error: "No ID Found" });
    })
    .catch(error => {
    res.status(500).json({
    error: error
    });
    });
    });

  • @jakubrpawlowski
    @jakubrpawlowski 6 ปีที่แล้ว

    Great video as always Max! Thank you again!

    • @academind
      @academind  6 ปีที่แล้ว

      Thanks so much Jakub!

  • @tayfoooooor
    @tayfoooooor 6 ปีที่แล้ว +1

    Great tutorial, Simple & Quick

    • @academind
      @academind  6 ปีที่แล้ว

      Thank you so much for your great feedback Mahmoud!

  • @Sun1ive
    @Sun1ive 6 ปีที่แล้ว

    Thank you very much for your lessons Max. Really appreciate it!

    • @academind
      @academind  6 ปีที่แล้ว

      Thank YOU for your comment, so happy to read that you like the videos!

  • @tharunrocky14
    @tharunrocky14 6 ปีที่แล้ว +10

    Awesome Max! Thanks! Yesterday I purchased your ReactJs course at Udemy, will start with it soon. Thanks for everything.. =)

    • @hcx1853
      @hcx1853 6 ปีที่แล้ว +2

      Tharun Shiv Did the same as well. Looking forward to the course. And your Vue.js course too.

    • @academind
      @academind  6 ปีที่แล้ว +6

      Thank YOU guys for your awesome support! Great to have you on board of the course, I really hope that you will like it :)

    • @luckystarsakkeer1312
      @luckystarsakkeer1312 5 ปีที่แล้ว

      @@academind Hi, Max. Can you upload another step by step playlist. How to implement ORM with mySQL into Node Js project. It's my request. :). i'm waiting for your reply, Or refer me some tutorials for this. I'm new to Node Js. I'm working as a Front end developer. Now I started the Back End Development. Your RESTful API tutorial was awesome and very clear. I want to use mysql in my project. Still I couldn't get the perfect tutorial for my problem.

  • @Bod88
    @Bod88 6 ปีที่แล้ว

    Your videos have forced me to start finally using modules...and I am grateful for it. T hank you.

    • @academind
      @academind  6 ปีที่แล้ว +1

      So great to read that Bod, thank you for your comment!

  • @khalidebrahim6086
    @khalidebrahim6086 6 หลายเดือนก่อน

    Thank you from Egypt 💙

  • @esericsu
    @esericsu 4 ปีที่แล้ว

    wow this is really really good. Please keep making more

  • @israelruas948
    @israelruas948 4 หลายเดือนก่อน

    Great, I am using MongoDB online and it is working super well. Thank you

  • @alevsoft
    @alevsoft 3 ปีที่แล้ว

    Awesome tut! Thank you :)

  • @codinginflow
    @codinginflow 3 ปีที่แล้ว +11

    I noticed that MongoDB adds the ObjectId automatically if you don't pass it

  • @rabiashah9686
    @rabiashah9686 5 ปีที่แล้ว

    I love you for this awesome explanation!! hats off to you! you saved my day!!

    • @academind
      @academind  5 ปีที่แล้ว

      So amazing to hear that, thank you so much Rabia!

  • @5timeslllll
    @5timeslllll 6 ปีที่แล้ว +34

    Thanks Max. For PATCH, I have a much better solution:
    const props = req.body;
    Product.update({_id: productId}, props);
    That’s it!
    It works like a charm, whether one prop has been passed or multiple.

  • @kumarsen88
    @kumarsen88 5 ปีที่แล้ว

    Having been primarily a Pythonista with some Scala Development experience, I have to admit that node consumes the Functional approach (partial functions, currying, map, filter etc) most effortlessly. Idk how many actually noticed that throughout the tutorial :)

  • @sarasherif7834
    @sarasherif7834 6 ปีที่แล้ว +10

    Great videos in node.js :)
    I have question, why did you added _id in schem ?
    I know it generate automatically

    • @NepalReddyChityala
      @NepalReddyChityala 6 ปีที่แล้ว

      To match the object property set on product.

  • @danielblank9917
    @danielblank9917 3 ปีที่แล้ว +3

    Your tutorials are great, giving likes for all of them! If I could say one thing, could you disable the documentation popups in vscode as it's a bit distracting and blocks the text

  • @HAL-9000-
    @HAL-9000- 4 ปีที่แล้ว

    diese Videos sind super, danke!

  • @rajatdhoot5936
    @rajatdhoot5936 6 ปีที่แล้ว

    Awesome tutorial Really great help to understand and build Rest Api from scratch

    • @academind
      @academind  6 ปีที่แล้ว

      Thanks so much, great to hear you enjoyed it Rajat!

  • @davidamado1048
    @davidamado1048 5 ปีที่แล้ว

    pretty cool man, thanks for this videos, I'm learning a lot with it

    • @academind
      @academind  5 ปีที่แล้ว

      Happy to read that David, thanks a lot for your comment!

  • @hamzaayech5966
    @hamzaayech5966 6 ปีที่แล้ว

    You are so good at teaching people, please keep going ♥

    • @academind
      @academind  6 ปีที่แล้ว

      It's really great to read that you like my teaching style, I'll try my best to keep it going Hamza!

  • @mekonnenhaileslassie5651
    @mekonnenhaileslassie5651 4 ปีที่แล้ว

    words in the comment can't express what u are doing! But i wanna tell u that u have to proud of your self b/c u are changing life of many people! You are really amusing person!

  • @rishabshrestha3061
    @rishabshrestha3061 6 ปีที่แล้ว

    Very helpful, Great Video, Thank you very much.

    • @academind
      @academind  6 ปีที่แล้ว

      Thank YOU for your great feedback Rishab!

  • @JoonasKarp
    @JoonasKarp 5 ปีที่แล้ว

    when your building restful api’s in the course do you also build front end for it and connect it all together like full stack ?

  • @nicola123ste
    @nicola123ste 4 ปีที่แล้ว +5

    Top teacher in the Internet. I am taking his React course on Udemy too.
    Can you please add the mySQL version too?

  • @tmacka88
    @tmacka88 6 ปีที่แล้ว +5

    How were you getting null returned with a get request when you added a "d" to the end of the ID? I get the error: "Cast to ObjectId failed for value" for everything except when it finds an actual ID in the db. Am I missing something?

  • @chagantisubhash
    @chagantisubhash 6 ปีที่แล้ว

    I downloaded these videos, kept them in a folder and now using them as a reference. Thanks alot!! I'll for sure buy Angular 6 complete guide course of yours in Udemy.

    • @academind
      @academind  6 ปีที่แล้ว

      Awesome! Welcome on board of the Udemy course, too! :-)

  • @gabrieljoshuapaet2572
    @gabrieljoshuapaet2572 6 ปีที่แล้ว

    First of all really great tutorials from you Max! Will you be creating a series dedicated to mongodb and mongoose?

    • @academind
      @academind  6 ปีที่แล้ว

      Thanks so much, happy to hear you liked it! Such a series is definitely possible, yes :)

  • @yatashdeepsharma203
    @yatashdeepsharma203 5 ปีที่แล้ว

    awesome tutorial mere bhai ... hats off u

  • @DuyTran-ss4lu
    @DuyTran-ss4lu 3 ปีที่แล้ว

    This man is a legend

  • @iceeagle2349
    @iceeagle2349 5 ปีที่แล้ว

    Very GREAT!!! and good understandable :) - Thanks a lot!

    • @academind
      @academind  5 ปีที่แล้ว

      Awesome to read that Maik, thank you very much for your great feedback!

  • @StackMentor
    @StackMentor 11 หลายเดือนก่อน

    #Academind this is the best tutorial over all this years since you created this playlist most people don't cove the fundamentals and authentication they use some dummy data from routes so far this the best i watched it like 5 times while i was doing node

  • @SARAVANAKUMARPS
    @SARAVANAKUMARPS 6 ปีที่แล้ว

    Though I subscribed to this channel and enabled notification, I come daily to check whether the next video has arrived or not! Thanks for the awesome series and you are the best tutor/mentor whatever!. Is there any plan on teaching complete Node Js and JWT.

    • @academind
      @academind  6 ปีที่แล้ว

      Thank YOU for your amazing feedback, I'm happy to hear you're liking the content on this channel! I will also show how to implement Authentication with JWT in this series, yes

  • @barjosa31blogspot83
    @barjosa31blogspot83 6 ปีที่แล้ว

    Max, keep it up!!! Thanks!

    • @academind
      @academind  6 ปีที่แล้ว +1

      I'll try my best to do so, thank you :)

  • @ngyi3553
    @ngyi3553 6 ปีที่แล้ว +2

    What keyboard shortcut do you use to restructure the chain methods?

  • @Sledno1
    @Sledno1 5 ปีที่แล้ว

    There is another possible way to delete by id, you can use:
    Product.findByIdAndRemove(productId)
    .then(result => {
    // Send result
    })
    .catch(err => {
    // Handle error
    });
    This one returns the document as the result.
    By the way thanks for this course, it has helped me a lot! :)

  • @alpsenel9196
    @alpsenel9196 3 ปีที่แล้ว

    You helped a lot !

  • @HACKTECH
    @HACKTECH 6 ปีที่แล้ว

    Can't we add directly an callback as a second argument in findById() or use exec() and attach it after findByID() because you used promise Approach using then()...so is it necessary to use it?

  • @AbdulMajeedShehzad
    @AbdulMajeedShehzad 6 ปีที่แล้ว

    Thank you so so much Max! i have learned to create Rest Api from some other channel and it was nice but no one can reach your level! the way you explain each and every thing is very awesome ... a lot of things needed explanation in that course but you explain each and every line in a way that we don't need any more explanations. One thing that i love the most of you is that you reply to each and every comment and this really show your concern with your students this shows that you really care about your every single student and not like many other youtubers who only care for their views!
    You are the best teacher i ever had!
    Love from Pakistan
    Another thing, you mentioned in this lecture that you will teach how to create API with MySql, where is that ? i have searched your channel but could not found it. if you have not created that yet then please create it i badly need that to learn.

  • @nanminkone
    @nanminkone 5 ปีที่แล้ว

    Nice Nice Nice...My project saw life because of this video

  • @noredinebahri6980
    @noredinebahri6980 5 ปีที่แล้ว +1

    when i want get data from mongoose with id (productId) i get this error
    "Unexpected token , in JSON at position 0"

  • @TarasChornyi
    @TarasChornyi 5 ปีที่แล้ว

    Good video! Thanks! Subscribed.

    • @academind
      @academind  5 ปีที่แล้ว

      Thank you Tapac, welcome on board!

  • @felipesecato1013
    @felipesecato1013 6 ปีที่แล้ว

    Awesome tutorials. It is helping a lot
    Greetings from Brazil

    • @academind
      @academind  6 ปีที่แล้ว

      Very happy to read that the videos are helpful for you Felipe, thank you for sharing this, greetings from Germany :)

  • @HidaytRahman
    @HidaytRahman 4 ปีที่แล้ว

    Very helpful tutorial - Can you help us to implement error handling in case of db is not connected due to incorrect passowrd or wrong url issue?

  • @vinothkumarv9722
    @vinothkumarv9722 3 ปีที่แล้ว

    Its really very good good session i love its the way of explanation and good quality content :) love you msir.

  • @phillippham8454
    @phillippham8454 5 ปีที่แล้ว +1

    What is the hotkey he is using to reformat the .exec.then.catch chain over multiple lines?

  • @alexhadimulya
    @alexhadimulya 6 ปีที่แล้ว

    Hi Max! Awesome tutorial as always! I am having an issue with all requests via postman on my macbook. It's giving me "Could not get any response" and the postman console shows "Error: socket hang up" after trying to connect for awhile. Have you ever encountered this issue before? Note: I have my mongo atlas db properly setup. Thx!

  • @neucoas
    @neucoas 6 ปีที่แล้ว

    Hi Maxi! Why on the models you set the _id and its type? Isn't those authomatically added by Mongoose?

  • @hotmandead1
    @hotmandead1 5 ปีที่แล้ว

    excellent tutorial

  • @seanbruceful
    @seanbruceful 5 ปีที่แล้ว

    hi max. I really enjoy this video and like your style of teaching. I also have a question here, in express js official document of database integration, it said that I should provide a callback function in MongoClient.connect method as second parameter which allow me to check if connection to database success or failed, and let me operate with the database in case no error happened. so I thought maybe I should wrap all my route logic in the callback function. but I didn't see you do such thing in this video. Could you tell me Why is it different? sorry for my poor English. thanks

  • @meghbalikamegh6909
    @meghbalikamegh6909 5 ปีที่แล้ว

    So I made user schema and adding user into database. but after I post 1, i can't post any other user without running into "duplicate key error collection" for some reason and I can't figure out why that's happening

  • @abdullaharz5945
    @abdullaharz5945 ปีที่แล้ว +2

    Such a Helpful tutorial. But two methods are not working (Update and Remove). So I replaced "Update" to "findByIdAndUpdate" and "Remove" to "findOneAndRemove". Then its work correctly. Thank you for this tutorial. ❤

  • @confearsion3778
    @confearsion3778 4 ปีที่แล้ว +3

    _id field is not required in 2019 I guess, plz tell me is it true?

  • @satyeshsoni1150
    @satyeshsoni1150 3 ปีที่แล้ว

    I am using node14+ version and angular 11. I am facing some issue between connectivity of them. Sometimes it will display such as "required is not found " and sometimes Display " out of module". How can I solve this issue? Please let me know.

  • @_blackmesa
    @_blackmesa 4 ปีที่แล้ว

    Max,
    I have finished this project and wanted to set it up with a front-end webpage (single page) on Heroku.
    However, Heroku doesn't provide an add-on (other than MongoDBs newly acquired mLab add-on for databasing) and MongoDB doesn't provide this service. I was wondering HOW can we set it up on the front-end webpage in order to use the database created with this course.
    Thank you so much for sharing such knowledge and I've got to say, this has been THE BEST teaching by far I have EVER had.
    will definitely keep learning with you!
    Cheers!

  • @peoray
    @peoray 5 ปีที่แล้ว

    Whenever I try my patch request on Postman, it works but postman doesn't update the JSON until I click on send again or do a get request and I see that my JSON has been updated. Any help on this?

  • @cptsakamoto
    @cptsakamoto 4 ปีที่แล้ว

    Nice tutorial

  • @qhpfr1
    @qhpfr1 6 ปีที่แล้ว +2

    Awesome
    I am waiting for a lesson on how to security the service(API)
    secure the API by JWT or etc.....
    thanks Man

    • @academind
      @academind  6 ปีที่แล้ว +4

      It'll be included in this series, no worries!

  • @fmaransatto
    @fmaransatto 6 ปีที่แล้ว

    What are the proper criteria when choosing between mysql and mongodb? I'm really getting mad at this point.

  • @harrydjalimun9272
    @harrydjalimun9272 5 ปีที่แล้ว +1

    Hi, i’ve some error :Connection Error { Error: queryTxt ETIMEOUT},i’ve try to delete olde cluster still have kind of error, pls somebody help me, thx

  • @alexandertarasenko3038
    @alexandertarasenko3038 5 ปีที่แล้ว

    Is there any way to use numeric ids instead of these?
    Because as for me links won't look good with these ids like
    todos/5bfaefc7be403d9bec33656d
    instead it would be cool to see common link like
    todos/121 for example

  • @thomasamaddeo3506
    @thomasamaddeo3506 5 ปีที่แล้ว

    Hey buddy...great tutorial...I was wondering if you ended up connecting MSSQL rather than mongodb. I am trying to achieve something similar through sequelize and being a newbie, i am kinda of struggling there. Do u think you can help? cheers

  • @amitbhandari8347
    @amitbhandari8347 5 ปีที่แล้ว

    While deleting, to remove object you need to use array splice function. It will not give you empty [ ]

  • @mylastore
    @mylastore 5 ปีที่แล้ว +2

    I just purchase your node.js on udemy just because you where born to teach and I am sure I will learn more from that as well as this.
    Have a question. Is there a reason to create the id on the model? since Mongo generates one automatically anyways.

  • @romanrogers1647
    @romanrogers1647 5 ปีที่แล้ว +1

    update is now deprecated, using updateOne seems to work fine, however it's adding on a __v: 0. Is this OK?

  • @eshikarya
    @eshikarya 4 ปีที่แล้ว

    In productSchema lets suppose I have address instead of price and an address contains both alphabets and numbers what should I use then? instead of "price : Integer" -> "address : ????"

  • @sourabhtashildar6510
    @sourabhtashildar6510 4 ปีที่แล้ว

    Hi, the part where you showed the patch request where you iterate through the req body by sending an array from postman. Can we do this instead?
    var updateOps = {};
    Object.keys(req.body).forEach(function (key) {
    updateOps[key] = req.body[key];
    });
    With this you can send the object directly. No need to send an array. Just another way of doing what you did maybe. correct me if I'm wrong.

  • @fensom80
    @fensom80 4 ปีที่แล้ว +1

    Trying this project with mysql but getting an internal server error(500)
    Does anyone have an example how to implement this with mysql?

  • @alind9947
    @alind9947 5 ปีที่แล้ว

    What s the advantage of using .then and .catch at 14:10 when you save a product instead of a callback? You basically do the same thing you would do with a callback as in getting the result and handling the error only that with .then and .catch you even type more lines of code.

  • @MrPik0s
    @MrPik0s 6 ปีที่แล้ว

    Hey max, what intellisense extension do you use for nodejs in vs code?

  • @JohanHiguitaRata
    @JohanHiguitaRata 5 ปีที่แล้ว

    You are the best! Perfect!

    • @academind
      @academind  5 ปีที่แล้ว

      YOU are the best Johan, thanks a lot for your comment!

  • @bhaveshpatil6569
    @bhaveshpatil6569 6 ปีที่แล้ว

    it showing error Employee is not defined
    at router.post (/home/js22/Desktop/api/api/routes/employee.js:13:20)

  • @poojasheokand5610
    @poojasheokand5610 4 ปีที่แล้ว

    how to get some details(parameters) from multiple details of same collection using mongoose , but not using any id
    for example I have five parameters i.e name ,age, jobId, clientId, and address
    but I want to get only three parameters = name, age, address .
    without using any id. how???

  • @zumatse
    @zumatse 6 ปีที่แล้ว +2

    Hi what is VSC shortcut to change inline exec().then().catch() to every function in new line?

    • @academind
      @academind  6 ปีที่แล้ว

      I don't know what the default was but search the keybindings for "code format" or just "format"

  • @sudhirmeena288
    @sudhirmeena288 5 ปีที่แล้ว

    Can you tell me what do i need to change in this. If i am using locally installed mongodb in my pc.

  •  6 ปีที่แล้ว

    How can I connect to backend from android studios or xcode? will you take a video for this part

  • @AbhishekKumar-mq1tt
    @AbhishekKumar-mq1tt 6 ปีที่แล้ว

    Thank u for this awesome video

    • @academind
      @academind  6 ปีที่แล้ว

      Thanks so much Abhishek really happy to read that you like the video!

  • @TheAlmightySushi
    @TheAlmightySushi 6 ปีที่แล้ว

    Wonderful tutorial. However, the patch request doesn't validate wether the changed e-mail or anything exists or not before switching. Does anyone know how to do it? Thanks!

  • @ebratz
    @ebratz 5 ปีที่แล้ว

    at 2019, you can use findOneAndUpdate which is smart enough to understand the parameters it should update on PATCH/PUT. No need to loop ops to filter. Also, needed to use some mongoose options: useNewUrlParser: true,
    useCreateIndex: true,
    useFindAndModify: false

  • @akhilmangalan4640
    @akhilmangalan4640 5 ปีที่แล้ว

    When i triend to check with an invalid id, postman end up with Could not get any response (In console : "Error: socket hang up"). Why this happened? Could you please help me out?

  • @jessiezhao8742
    @jessiezhao8742 5 ปีที่แล้ว

    Really great tutorial! Wondering at around 17:10 which VSC shortkey ? did you use to restructure chained functions into multiple lines?

    • @academind
      @academind  5 ปีที่แล้ว

      Thank you for your great feedback Jessie. I just use the "Format Document" function in VS Code (you can find it in the Keyboard Shortcuts menu).

  • @dmitry4638
    @dmitry4638 3 ปีที่แล้ว +1

    By any reason the patch request doesn't work with this body:
    [
    {"propName": "name", "price": "15000000"}
    ]
    it says:
    {
    "error": {
    "message": "req.body is not iterable"
    }
    }

  • @solomon4470
    @solomon4470 3 ปีที่แล้ว

    I need help with the post-request session. keep getting this
    "error": {
    "message": "Cannot read property 'Types' of undefined"
    }
    not sure what's causing it.

  • @vinhtrinh8306
    @vinhtrinh8306 5 ปีที่แล้ว

    when deploy heroku I don;t wan't use localhost with mongodb. What should i do ?