I first came across this error while solving Freecodecamp's API and Microservices project Exercise-Tracker. I was trying to update an array in my DB using JavaScript "push" method but I kept running into this block. The solution to this is to include a settings object "usePushEach: true".
Here's how it's done:
const MySchema = new Schema({
name:String
},{usePushEach:true})
`
According to the Github issues, this should not be a problem from mongoose 5.0 and above, but unfortunately it's still there.Hopefully this is fixed in future release. :)
Top comments (0)