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!
@sephiroLord8 ай бұрын
Thank you Sir! much appreciated!
@SteveLewis20244 ай бұрын
Annoyingly, I d found this comment after looking at the Mongo forum -_-
@unaisulhadi91023 жыл бұрын
3 Years later, Still this one is the best Node REST tutorial on Internet. ❤❤❤
@ragunath_br8 ай бұрын
Its still the best one I have seen too.. And its been 6 years now..
@hyojungyu16673 жыл бұрын
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})) })
@izzy74023 жыл бұрын
helpful, thanks man
@matthewrideout4263 жыл бұрын
great - thanks :)
@ganeshan563 жыл бұрын
instead of set, we can also use the extend function from lodash package.
@dr.franxx2 жыл бұрын
thank you
@burhanali74492 жыл бұрын
Thanks
@dorukoktay10546 жыл бұрын
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); } });
@mikaeledebro11446 жыл бұрын
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).
@alihasana20096 жыл бұрын
Thanks Mikeal
@darshu626 жыл бұрын
MAX code didnt work for me, but your code did. Thanks Mikael...
6 жыл бұрын
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]; }
@5timeslllll6 жыл бұрын
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.
@ruslanuchan88806 жыл бұрын
Loved this!
@moviejungle14306 жыл бұрын
Nice!
@madarauchiha62905 жыл бұрын
thanks :)
@caloriecoin5 жыл бұрын
Thank you!
@fabio40794 жыл бұрын
Explain? I can't make it patch here.
@mikemalone48676 жыл бұрын
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!
@academind6 жыл бұрын
Thanks a lot for your wonderful feedback Mike, it really makes me happy to read that the video was understandable and helpful :)
@MarcosLopez-bs6xr4 жыл бұрын
This is the only REST tutorial where I don't have to stress over the configuration thank you!
@tonhuu71324 жыл бұрын
Very easy to understand and explain in detail. Thanks Max!
@academind4 жыл бұрын
Glad it was helpful!
@harsh78094 жыл бұрын
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 }); }); });
@mawalibhai6367 ай бұрын
Thanks
@lilithfirefly37274 жыл бұрын
really helpful thanks. I saw many other newer videos but this one is the best
@ificouldfly48745 жыл бұрын
7:58: you need to replace {useMongoClient: true} by { useNewUrlParser: true, useUnifiedTopology: true } + don't forget to restart your nodejs server
@ificouldfly48745 жыл бұрын
@@internet4543 ty Captain Obvious
@sagarkumar07115 жыл бұрын
When I try to connect the mongodb via URL string it is working fine, but if I use + process.env.MONGO_ATLAS_PW + and accessing this environment variable from the nodemon.js file as shown in the video I am getting Error as below : (node:17036) UnhandledPromiseRejectionWarning: MongoError: bad auth Authentication failed. at _authenticateSingleConnection (D: ode-rest-shop ode_modules\mongodb\lib\core\auth\auth_provider.js:46:25) at sendAuthCommand (D: ode-rest-shop ode_modules\mongodb\lib\core\auth\scram.js:215:18) at Connection.messageHandler (D: ode-rest-shop ode_modules\mongodb\lib\core\connection\connect.js:334:5) at Connection.emit (events.js:198:13) at processMessage (D: ode-rest-shop ode_modules\mongodb\lib\core\connection\connection.js:364:10) at TLSSocket. (D: ode-rest-shop ode_modules\mongodb\lib\core\connection\connection.js:533:15) at TLSSocket.emit (events.js:198:13) at addChunk (_stream_readable.js:288:12) at readableAddChunk (_stream_readable.js:269:11) at TLSSocket.Readable.push (_stream_readable.js:224:10) at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) (node:17036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:17036) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. So if you know why I am getting this help me out. Thanks in advance!! :)
@MrWezra5 жыл бұрын
@@sagarkumar0711 Did you get a fix for this?
@gugulothvijaynayak43504 жыл бұрын
@@sagarkumar0711 How to fix? Did you get any solution? Help me out
@gugulothvijaynayak43504 жыл бұрын
@@MrWezra Any solution? how to fix it?
@odorlessflavorless5 жыл бұрын
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.
@academind5 жыл бұрын
Thank you Ananta, I might indeed release such videos from time to time in the future :)
@michaeltrembovler83014 жыл бұрын
The best explanation I've only listened to from anyone !!! Many thanks.
@TheMaxik5 жыл бұрын
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!!!
@academind5 жыл бұрын
Just awesome to read that, thanks a lot for your comment!
@codinginflow3 жыл бұрын
I noticed that MongoDB adds the ObjectId automatically if you don't pass it
@realdotty53562 жыл бұрын
Ok
@Bod886 жыл бұрын
Your videos have forced me to start finally using modules...and I am grateful for it. T hank you.
@academind6 жыл бұрын
So great to read that Bod, thank you for your comment!
@israelruas948 Жыл бұрын
Great, I am using MongoDB online and it is working super well. Thank you
@shiva_tharun7 жыл бұрын
Awesome Max! Thanks! Yesterday I purchased your ReactJs course at Udemy, will start with it soon. Thanks for everything.. =)
@hcx18537 жыл бұрын
Tharun Shiv Did the same as well. Looking forward to the course. And your Vue.js course too.
@academind7 жыл бұрын
Thank YOU guys for your awesome support! Great to have you on board of the course, I really hope that you will like it :)
@luckystarsakkeer13126 жыл бұрын
@@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.
@Sledno16 жыл бұрын
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! :)
@mekonnenhaileslassie56515 жыл бұрын
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!
@jameswaring62005 жыл бұрын
You have a really great way of explaining things!
@nicola123ste4 жыл бұрын
Top teacher in the Internet. I am taking his React course on Udemy too. Can you please add the mySQL version too?
@danielblank99173 жыл бұрын
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
@rotrose75314 жыл бұрын
Thank you very much, possibly best rest api tutorials I can find on youtube.
@chagantisubhash6 жыл бұрын
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.
@academind6 жыл бұрын
Awesome! Welcome on board of the Udemy course, too! :-)
@udaipman77614 жыл бұрын
26:27 my product is not delete successfully. Instead of remove method I used deleteOne because remove method is not valid anymore.
@udaipman77614 жыл бұрын
I solved this issue by Const productId = req.params.id.toString().trim(); Now it works but I don't know why
@bomaspeedy230210 ай бұрын
Thanks it works for me now ( deleteOne)
@Rallek6 жыл бұрын
Thank you for making such incredible tutorials. You are a great teacher!
@academind6 жыл бұрын
So happy to read that Rallek, thank you very much for this awesome feedback!
@user-zb5jp4ti1d7 жыл бұрын
i have always been struggling with the difference betn schema and model and how they fit together... until now though - key breakthrough for me around the 11:00 mark: "you export the schema wrapped in a model..." As always, thanks so much, Max... You are, in the words of Yuval Harari, a Homo Deus.
@academind7 жыл бұрын
That's so awesome to read Ashim, thank you very much for sharing this! Really happy to read that I could help making things clearer for you :)
@kumarsen886 жыл бұрын
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 :)
@npip996 жыл бұрын
22:10 Bit of a suggestion for better status code returns, status code 500 should be for an internal error, as stated by postman. Malformed input is supposed to return status code 400 (Bad Request).
@academind6 жыл бұрын
Thanks for sharing this improvement, much appreciated!
@luigivampa97806 жыл бұрын
Hey Max! I found your course really compelling. Thank you
@academind6 жыл бұрын
Thanks a lot for your comment Luigi, happy to read that you liked the course!
@StackMentor Жыл бұрын
#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
@hamzaayech59666 жыл бұрын
You are so good at teaching people, please keep going ♥
@academind6 жыл бұрын
It's really great to read that you like my teaching style, I'll try my best to keep it going Hamza!
@SARAVANAKUMARPS7 жыл бұрын
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.
@academind7 жыл бұрын
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
@benstuijts56207 жыл бұрын
Why not using your error middleware for handling your errors? This will produce less same code... ;-) Great series btw!
@tayfoooooor6 жыл бұрын
Great tutorial, Simple & Quick
@academind6 жыл бұрын
Thank you so much for your great feedback Mahmoud!
@dmitry46384 жыл бұрын
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" } }
@gabrieljoshuapaet25727 жыл бұрын
First of all really great tutorials from you Max! Will you be creating a series dedicated to mongodb and mongoose?
@academind7 жыл бұрын
Thanks so much, happy to hear you liked it! Such a series is definitely possible, yes :)
@esericsu4 жыл бұрын
wow this is really really good. Please keep making more
@ajaytiwari7154 жыл бұрын
24:41: replace remove with deleteOne as remove method is deprecated.
@WatDiggityDawg4 жыл бұрын
to be fair this vid is from 2017
@ajaytiwari7154 жыл бұрын
@@WatDiggityDawg yes true, but people are still learning from these videos and they may face difficulty due deprecated functions so like few others who have shared solution for bug or error i also shared..
@ebratz5 жыл бұрын
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
@khalidebrahim6086 Жыл бұрын
Thank you from Egypt 💙
@J0pain7 жыл бұрын
Why the "_id" in the productSchema isn't it there by default ?
@mohsenmadi35906 жыл бұрын
Actually, adding it gave me an error "TypeError: Undefined type `ObjectID` at `_id`". Removing it worked fine - at least for now.
@marianeppinheiro6 жыл бұрын
me too =/
@marianeppinheiro6 жыл бұрын
Actually I just fixed it, check out if you are not instanciating the objectID type on the schema. that was my mistake.
@luciusrex6 жыл бұрын
use const productSchema = mongoose.Schema({ _id: mongoose.Schema.Types.ObjectId, name: String, price: Number });
@rajatdhoot59367 жыл бұрын
Awesome tutorial Really great help to understand and build Rest Api from scratch
@academind7 жыл бұрын
Thanks so much, great to hear you enjoyed it Rajat!
@codinginflow3 жыл бұрын
Tip: In the newer versions of Node you don't have to type --save anymore. It's the default behavior now.
@dusnen5 жыл бұрын
If you are having problem for PATCH request, use this: router.patch("/:productId", (req, res, next) => { Product.updateOne({ _id: req.params.productId }, { $set: req.body }) .exec() .then(result => { res.status(200).json({ message: "Updated successfully" }); }) .catch(err => { console.log(err); error: err; }); }); it works for me
@gofudgeyourselves90245 жыл бұрын
Thanks a lot man
@zaloaustine4 жыл бұрын
Saved me after lots of hours of research and code re-writing
@AbdulMajeedShehzad6 жыл бұрын
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.
@mateusloubach5 жыл бұрын
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!
@felipesecato10136 жыл бұрын
Awesome tutorials. It is helping a lot Greetings from Brazil
@academind6 жыл бұрын
Very happy to read that the videos are helpful for you Felipe, thank you for sharing this, greetings from Germany :)
@jakubrpawlowski7 жыл бұрын
Great video as always Max! Thank you again!
@academind7 жыл бұрын
Thanks so much Jakub!
@Alex-jy8ze Жыл бұрын
I encountered some error at 15:03 using the local mongodb and I don't know how to fix it error: C:\API2 ode-rest-shop ode_modules\mongodb\lib\connection_string.js:273 throw new error_1.MongoParseError(`${optionWord} ${Array.from(unsupportedOptions).join(', ')} ${isOrAre} not supported`); ^
@brianwahome57896 жыл бұрын
Though optional, kindly review the invariant, Should be if (doc.length > 0), not (doc.length >= 0)
@vinothkumarv97223 жыл бұрын
Its really very good good session i love its the way of explanation and good quality content :) love you msir.
@daniell27744 жыл бұрын
At the 28:08 time stamp; there's if(docs.length >= 0) { do stuff }. To my understanding that will always be true if there's no entries in the products. Shouldn't it be if(docs.length >= 1) { there's at least one or more entry -> show entry/entries.} ELSE { show the 404 error along with the message } Please correct me if I'm wrong!
@balporsugu71984 жыл бұрын
yeah i agree with you. he missed it because as he mentioned he does not consider that situation as an error.
@mihaidraghicescu10207 жыл бұрын
Great series! Will you make a short tutorial with REST API and MYSQL ?
@academind7 жыл бұрын
Thanks so much, I'm glad you're liking it! I might add MySQL in the future, got no concrete plans on that right now though.
Awesome I am waiting for a lesson on how to security the service(API) secure the API by JWT or etc..... thanks Man
@academind7 жыл бұрын
It'll be included in this series, no worries!
@amitbhandari83476 жыл бұрын
While deleting, to remove object you need to use array splice function. It will not give you empty [ ]
@mavisakal776 жыл бұрын
Great tutorial but I would suggest Model.findByIdAndRemove(req.params.id).exec().then().catch() and Model.findByIdAndUpdate(req.params.id, req.body, {new: true}).exec().then().catch() for delete and update. Much easier and clean to implement.
@dhananjayfarmaha30415 жыл бұрын
hey i am following your tutorial...everything was working fine until at 19:00..i am getting no response ..it just shows "loading..." message in postman and nothing is being displayed on the terminal window as well. Please help, i've been googling it for almost a week now and found nothing helpfull. Thank you
@dhananjayfarmaha30415 жыл бұрын
my ".then()" promise is not getting executed...and if i enter a wrong id, then the error handled by catch block is getting executed correctly
@nataliexsl15 жыл бұрын
@@dhananjayfarmaha3041 did you solved it?
@pdxJaxon5 жыл бұрын
Im having the exact same issue.....any resolution? router.get('/:prospectId', (req,resp,next) => { const id = req.params.prospectId; console.log("Valid",mongoose.Types.ObjectId.isValid(id)); Prospect.findById(id) .exec(console.log("EXEC")) .then(data =>{ console.log("I DIE HERE...."); resp.status(200).json(data); }) .catch(err =>{ console.log(err); resp.status(500).json({ Message:err, id:id, Valid:mongoose.Types.ObjectId.isValid(id)}) });
@ngyi35536 жыл бұрын
What keyboard shortcut do you use to restructure the chain methods?
@DuyTran-ss4lu4 жыл бұрын
This man is a legend
@Angela131113 жыл бұрын
Hi, Anyone that will get this error: (node:2096) UnhandledPromiseRejectionWarning: MongoParseError: option usemongoclient is not supported at Object.parseOptions just delete the line: usemongoclient = true; in the apps.js file. took me 3 days to figure it out hope it will assist someone else.
@GolemShadowsun2 жыл бұрын
You saved me just HOURS of debugging.
@sarasherif78347 жыл бұрын
Great videos in node.js :) I have question, why did you added _id in schem ? I know it generate automatically
@NepalReddyChityala7 жыл бұрын
To match the object property set on product.
@Sun1ive7 жыл бұрын
Thank you very much for your lessons Max. Really appreciate it!
@academind7 жыл бұрын
Thank YOU for your comment, so happy to read that you like the videos!
@rhandect4 жыл бұрын
Thank you so much, you have helped guide me in the right direction for my project :)
@starboy57656 жыл бұрын
Awesome tutorial Max! But Unfortunately got stuck when sending this POST request at 15:45, it shows me an error. "error": { "message": "Product is not a constructor" }
@cavinalbertbelga50906 жыл бұрын
Same, did you find a fix?
@captainzerodegree81626 жыл бұрын
You probably missing module export from product model
@santiagorestrepo48745 жыл бұрын
make sure your export sentence in product.js is module.exports = mongoose.model('Product', productSchema) instead of module.export = mongoose.model('Product', productSchema)
@alind99475 жыл бұрын
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.
@nanminkone5 жыл бұрын
Nice Nice Nice...My project saw life because of this video
@rabiashah96866 жыл бұрын
I love you for this awesome explanation!! hats off to you! you saved my day!!
@academind6 жыл бұрын
So amazing to hear that, thank you so much Rabia!
@amilab6825 жыл бұрын
How to solve this? UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
@MrWezra5 жыл бұрын
did you solve this?
@mylastore6 жыл бұрын
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.
@jeanpaulgiraldo6 жыл бұрын
When I followed the video Mongoose is on version 5.1.1. I was having problems with removing a product using Product.remove({ _id: id }) The error provided by MongoDB said: "Cannot use (or request) retryable writes with limit=0" If anyone else has this problem just replace Product.remove({ _id: id }) with Product.findByIdAndRemove(id) it worked for me
@TheMypencil6 жыл бұрын
Thank you
@김세경-o3i6 жыл бұрын
Thank you
@joshuaclay15946 жыл бұрын
Thanks so much. Development would be so much easier if there weren't the constant gotchas of changing protocols.
@JuanFVasquez6 жыл бұрын
Thanks!! That worked perfectly
@spectrecular97216 жыл бұрын
*Product.deleteOne({ _id: id })* worked for me
@marcin2x44 жыл бұрын
In 20:52 I don't get both attributes: message and name for error prompt.
@zenner244 жыл бұрын
if you are using mongoose in April 2020 and get an error while trying to connect, you need to get the connection string in the MongoDb Atlas for Node.js 2.2.12 or later the second argument in the connect function should be: useNewUrlParser: true, useUnifiedTopology: true
@asdqwe44277 жыл бұрын
Your patch method is strange to me. Why would you pass an array of objects to a URL that takes an id? Could you not just use whatever is in the body? I tried it and it seems to work fine for me.
@markwonder81685 жыл бұрын
What's the shortcut to quickly refactor .exec().then().catch() to multiple lines?
@muchvibrant5 жыл бұрын
prettier
@tmacka886 жыл бұрын
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?
@saurabhgupta66914 жыл бұрын
yes
@alevsoft4 жыл бұрын
Awesome tut! Thank you :)
@Isookov6 жыл бұрын
Great series Max! Any chance doing this with bookshelf? To many tutorials work with mongoose the same things and it's a little bit repetitive. Keep going my friend! :)
@academind6 жыл бұрын
Thanks for the great feedback and you suggestion! I haven't really worked with it so it's not that likely in the near future I'm afraid.
@phillippham84546 жыл бұрын
What is the hotkey he is using to reformat the .exec.then.catch chain over multiple lines?
@buchiemmanuel266 жыл бұрын
If you get mongoose.Types.ObjectId is not a constructor error remove the parenthesis on " _id: new mongoose.Types.ObjectId," line 15, minute 14:14
@yatashdeepsharma2036 жыл бұрын
awesome tutorial mere bhai ... hats off u
@abelmurua69803 жыл бұрын
Awesome, do you have a Mongoose course?
@bluesky67516 жыл бұрын
23:04 how do you arrange those lines like that in VC code??
@sriramtorvi74175 жыл бұрын
Exactly my question.. btw... have you got the answer for that???
@davidamado10485 жыл бұрын
pretty cool man, thanks for this videos, I'm learning a lot with it
@academind5 жыл бұрын
Happy to read that David, thanks a lot for your comment!
@matiasbarrios74276 жыл бұрын
sorry but i need some of help, when i use the post like the video in the min 15:18 i get { "error": { "message": "Product is not defined" } } i realy need help pleace :'c
@SaiPravesh4 жыл бұрын
Very detailed and awesome explanation, thank you very much
@confearsion37785 жыл бұрын
_id field is not required in 2019 I guess, plz tell me is it true?
@HAL-9000-5 жыл бұрын
diese Videos sind super, danke!
@naptoon15785 жыл бұрын
[14:57] *_id : mongoose.Types.ObjectId* will not throw errors anymore so no need to add Schema *( node version used : v12.14.1)* *Ps :* Works with Schema as well.
@majs67084 жыл бұрын
I tried with both but I get this error: "TypeError: Cannot read property 'ObjectId' of undefined " I don't know what I'm doing wrong, I did exactly like in the video :(
@alpsenel91964 жыл бұрын
You helped a lot !
@intercointerface2126 жыл бұрын
At 31:40 what's with the whole rigmarole manipulating the request before patching it; could you not just { $set: res.body } instead of copying res.body into updateOps then doing what you did?
@prashantchaudhari61836 жыл бұрын
I think instead of using promises, async/await would be great. Yeah i know async/await are basically promises but it would help in writing cleaner code.
@solomon44703 жыл бұрын
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.
@agung_laksana5 жыл бұрын
max, please create mongoose course in detail :D
@jessiezhao87426 жыл бұрын
Really great tutorial! Wondering at around 17:10 which VSC shortkey ? did you use to restructure chained functions into multiple lines?
@academind6 жыл бұрын
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).
@zumatse7 жыл бұрын
Hi what is VSC shortcut to change inline exec().then().catch() to every function in new line?
@academind7 жыл бұрын
I don't know what the default was but search the keybindings for "code format" or just "format"
@vatroslavmorbidovic41057 жыл бұрын
I got this error: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017] (node:3816) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. What gives?
@bikashranjan95857 жыл бұрын
Same error is also appearing for me
@martinsmuts25577 жыл бұрын
I did the following and it seemed to work for me: 1. hardcode your password in the connection string in the app.js file and do not use the environment variable in the nodemon.json file 2. try to comment out or remove "useMongoClient: true" in app.js 3.stop the server "ctrl + C". 4. start the server with npm start again