Cast to ObjectId failed for value “586cc8b3ea780c071bbe2469” at path “_id” for model “User”

后端 未结 2 565
不思量自难忘°
不思量自难忘° 2021-01-20 13:14

I saw a couple of post with similar to mine but I still getting the same error

here is my user schema

2条回答
  •  囚心锁ツ
    2021-01-20 13:31

    I had the same problem with mongoose version > 4.7.2

    Problem is about bson package.

    I solved it with installing an older version of mongoose.

    npm install mongoose@4.7.2

    or you can change package.json to use exact version 4.7.2 "mongoose": "4.7.2"

    You can update to newer versions after the problem is solved. You can track it on here.

提交回复
热议问题