mongoose-lean-defaults icon indicating copy to clipboard operation
mongoose-lean-defaults copied to clipboard

Align default subdocument behavior with Mongoose

Open peplin opened this issue 1 year ago • 0 comments

Mongoose sets subdocument defaults to undefined (docs). This changes the behavior of mongoose-lean-defaults to match.

Previously, it returned a new object ({}) which may have been given a newly generated Object ID (depending on if the schema for the subdocument set _id: false).

This is an example of how we might change the behavior of this plugin to fix https://github.com/DouglasGabr/mongoose-lean-defaults/issues/32. It is a change in behavior so it should be considered a breaking change, but it better aligns this plugin with Mongoose itself so you can switch between lean and hydrated queries with greater ease.

peplin avatar Oct 31 '23 15:10 peplin