#api route breaking

1 messages ยท Page 1 of 1 (latest)

drowsy crescent
#

Continue here!

pale holly
#

Oh thanks

drowsy crescent
#

Delete those and I think you are not getting the data in you request body, log them to check!

#

By those I meant the SS, share them inthis thread!

pale holly
#

here are the sechmas

#

and now , here is how i did THE POST METHOD

drowsy crescent
#

Share the complete error

pale holly
#

here is the form

#

ok

#

HERE IS THE ERROR i fixed it

drowsy crescent
pale holly
#

ReferenceError: ObjectId is not defined

drowsy crescent
#

Oh sorry, you wrote that you fixed it that's why!

pale holly
#

i added var fileId = mongoose.Types.ObjectId();

#

but still not working

drowsy crescent
#

Hey! I've some exposure to this give me some time. This is not the right way to solve it.

pale holly
#

take your time bro ๐Ÿ™‚

drowsy crescent
#

How are you passing the I'd in the objectId

#

62dbf............... Why it looks like hard-coded!?

pale holly
#

here it is ๐Ÿ™‚

#

i copied it

drowsy crescent
#

First you must send the I'd via req body and then used the following approach.

pale holly
#

i'm just doing testing to push comment

drowsy crescent
#

import { ObjectId } from "mongodb"

let id = ObjectId(req.body._id)

Then pass this to your function

drowsy crescent
pale holly
#

it's working with no errors

#

but nothing is pushed yet

drowsy crescent
#

Yes, debug more on the update method you are calling. Let me know if you need more help after trying!

pale holly
#

i never used debugging i will try

pale holly
#

me trying to do debug for 30 minutes but still confusing

drowsy crescent
pale holly
#

yes please :))

#

would be kind from you

drowsy crescent
#

just reached home bro, If you can hop on a meet call tomorrow after 10, we can debug it together!

pale holly
#

hey

#

yes please

pale holly
#

bro u here ๐Ÿ™‚

#

i was searching for you SKKFDSFDS

drowsy crescent
#

Yep, was busy in festivities!

pale holly
#

Take ur time bro ๐Ÿ™‚

pale holly
#

u here :))

drowsy crescent
#

Yeah, any progress!?

pale holly
#

no:(

#

same

pale holly
#

heyy

#

there is progress

drowsy crescent
#

Yeah, great!

pale holly
#

heyy

#

i wana use populate method in mongodb to get the author name from other sechmas ๐Ÿ™‚

#

i finished posting comments and getting it , and when getting it i need to convert my author id to author name

frigid spoke
#

this is a problem everyone is experience ?

pale holly
#

now trying to save a profile picture for each user

frigid spoke
#

Well done bud !