-
-
Notifications
You must be signed in to change notification settings - Fork 4k
added schema level lean option #12081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
It's complaining about one line in model.js that
The line is 3691 if you want to take a look |
AbdelrahmanHafez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks! 👍
Can you also add the option to the JSDoc and TS type definitions + TS tests?
Also, what do you think of calling it defaultLean instead of lean?
How would we go about overriding that for a specific query? I think we can .setOptions({ lean: false });, I also think it might be useful to have a .notLean() method that does the reverse of .lean().
Co-authored-by: Hafez <[email protected]>
| name: 'I am a lean doc, fast and small' | ||
| }); | ||
| const entry = await Test.findOne(); | ||
| assert.equal(entry instanceof mongoose.Document, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an extra check in this test that verifies you can still overwrite lean().
So const doc = await Test.findOne().lean(false); assert.ok(entry instanceof mongoose.Document)
Also, no need to do assert.equal(entry instanceof mongoose.Document, false);. Just assert.ok(!entry instanceof mongoose.Document);
vkarpov15
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking this as "Request changes" since I selected the wrong radio button previously.
Netlify functions example
No description provided.