setDefaultsOnInsert behaviors as default to true, is it expected? #10643
Labels
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
Milestone
Hi,
This will be a simple question, so I didn't follow the template. The background is that we upgrade mongoose recently and discovered that the setDefaultsOnInsert is acting as default to be true. After dig into the code, figured on this line, i.e.
The strict === false check makes the value to be
undefined
and jump out of the if block. Is it expected?Also, I figured that I can do
mongoose.set('setDefaultsOnInsert', false)
to toggle the default behavior. But reading through https://mongoosejs.com/docs/defaults.html , it makes feel the default behavior isfalse
. Caused a bit of confusion.Thanks!
The text was updated successfully, but these errors were encountered: