Skip to content

Commit 5a24900

Browse files
vkarpov15Copilot
andauthored
Update index.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d5f5afe commit 5a24900

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ function applyGetters(schema, res) {
4242
if (res == null) {
4343
return;
4444
}
45+
// Skip applying getters if the `lean` option is false.
46+
// This ensures that Mongoose getters are not applied to non-lean queries.
4547
if (!this._mongooseOptions?.lean) {
4648
return;
4749
}

0 commit comments

Comments
 (0)