mongoose-lean-defaults
mongoose-lean-defaults copied to clipboard
Attach defaults to the results of mongoose queries when using .lean()
Hello, i recently noticed when using default true, it will return certain fields which i find weird as i didn't add them to select. **mongoose: 6.3.5 mongoose-lean-defaults: 2.2.1** ``` import...
**Describe the bug** Importing the lean-defaults as instuctued, and attempted both `import x` and `import {default as x}`, getting the following error: Error: First param to `schema.plugin()` must be a...
fixes #36 The PR changes the comparison between selected fields and available fields to either match partially with suffix `.` or strictly equal. It can probably be fixed more elegantly...
**Describe the bug** The projection returns unselected fields when they start with another field name. For instance, if we have the following schema ```js const schema = new Schema({ myField:...
**Describe the bug** Seems to be similar to #30 In the latest version (2.2.1) a schema that contains a subdocument (in my case with the _id field turned off) results...
Mongoose sets subdocument defaults to `undefined` ([docs](https://mongoosejs.com/docs/subdocs.html#subdocument-defaults)). This changes the behavior of `mongoose-lean-defaults` to match. Previously, it returned a new object (`{}`) which may have been given a newly generated...
The global default is a useful option, but I didn't realize it existed at first. It's worth mentioning in the README. Thanks!