ed-roh / mern-social-media

Complete React MERN Full Stack Social Media App
992 stars 859 forks source link

Problem #1

Open Jean-pierre14 opened 1 year ago

Jean-pierre14 commented 1 year ago

I'm learning code with your video step by step... but I don't understand why when I want to insert many it refuses. image

Jean-pierre14 commented 1 year ago

If it's a mongoose problem tell us...

pankajboruah commented 1 year ago

Jean-pierre14

It says validation error for User. Check your User model. You might have set a different type for "friends".

02abhishekchoudhary commented 1 year ago

You can comment out line no. 71 & 72. It was just for creating manually users and posts for testing purposes.

vicky9168 commented 1 year ago

ADD DATA ONE TIME

Jean-pierre14 commented 1 year ago

Let me try it and I will let you know.

kotaid commented 1 year ago

probably you have set the type of friends in the user model to string, then in the data it is an array, so you got a validation error.

Nishaaaanth commented 1 year ago

Just change the type of friends to [String] in the User model. Voila!