463 viewsMern Amazona
0 Comments

After clicking on Place Order i get this error…

{“message”:”Order validation failed: orderItems.0.product: Cast to ObjectId failed for value \”3\” (type string) at path \”product\” because of \”BSONTypeError\”, orderItems.0._id: Cast to ObjectId failed for value \”3\” (type string) at path \”_id\” because of \”BSONTypeError\””}

Bassir Answered question March 9, 2023

you need to remove cookies first

then make sure that you are reading products from the database.

IDs of product in the database is not like 1, 2 or 3 they are 24 characters

then try to put the order and place an order and you will not get this error anymore.

Bassir Answered question March 9, 2023