Skip to content

Conversation

@vkarpov15
Copy link
Collaborator

Fix #15218

Summary

toObject() and toJSON() currently return an object with all fields from the document in the database, which may include fields that aren't in the schema. To work around that, we added a schemaFieldsOnly option to toObject() and toJSON(), which will loop over schema paths when getting values vs just cloning the entirety of _doc.

Examples

@vkarpov15 vkarpov15 added this to the 8.11 milestone Feb 13, 2025
Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some minor style suggestions.

@vkarpov15 vkarpov15 merged commit 48f9574 into 8.11 Feb 17, 2025
77 checks passed
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-15218-2 branch February 17, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants