bradtraversy / proshop-v2

ProShop ecommerce website built with MERN & Redux Toolkit
532 stars 267 forks source link

Facing issues in data seeder script #23

Closed rehan-ankalgi-7t2 closed 9 months ago

rehan-ankalgi-7t2 commented 9 months ago

Hi Brad, i've been follwing your tutorial lately and it was going pretty well untill i faced this error in data:import script for importing data in the database

‼️ ValidationError: _id: Cast to ObjectId failed for value "1" (type string) at path "_id" because of "BSONError", password: Path `password` is required., email: Path `email` is required.

however the data:destroy script works fine 👍🏻.

it'll be glad if you could suggest a fix for this.

thanks!

bushblade commented 9 months ago

Hi @rehan-ankalgi-7t2 Is this in your own project? I cannot reproduce the issue you describe in this project. If you are a student of Brads needing assistance then please post in the course Q&A or on Brads Discord server, make sure to include a link to your projects repository. However your error seems pretty clear. You are trying to use the string '1' as an ObjectId which it is not you are also missing required fields.

rehan-ankalgi-7t2 commented 9 months ago

Hi @bushblade thanks for reminding me about the Q&A for the course 😃, I'll reach out to brad if have any issue and moreover i fixed this particular issue, no worries 👍🏻