3

Hi! I've Been Watching a Tutorial series on How to make Amazon clone by nodejs,mongodb. He used Faker Api to insert Product but I tried to make a seperate Layout to insert product but using Async but it keeps saying "Cannot read Property '_id' of undefined.

Comments
  • 0
    Any Help is Appreciated.
  • 1
    There's probably no res.body.category.categories in the data you requested.
    BTW May I introduce you to StackOverflow?
  • 0
    @Cube189 Yes, I just saw that Line and Deleted and the error still exist. I've tried Stackoverflow People over there are Rude. Thanks Anyways
  • 0
    @Rishabh112 What about product.category = category._id? Check what is sent as category.
  • 0
    @Cube189 That line is correct and The error is now gone but there is different Error "ValidationError: Product validatoon failed". Any idea why?
  • 0
    @Rishabh112 Doesn't the stack trace provide anything meaningful?
  • 0
    @Cube189 Nope, Nothing I can see.
  • 0
    There's probably something wrong with the Product object you send to add-product. Wrong type of property or too many, or too little. It's either Mongoose that gives the error or add-product.
  • 0
    @Cube189 Yes, I fixed it I think Image url was too long or Product Name. Can you tell me How to increase the Limit and Thank You very Much.
  • 0
    Pastebin the code, make it easier for other people to read and help.
  • 0
    @rishabh112 which tutorial are you referring ?
  • 0
    @saiprasad "Build an Amazon clone: Nodejs + MongoDB + Stripe Payment" Look it up on Udemy.
Add Comment