Skip to content

fix(query): include preview of current and incoming update in error when merging normal update with pipeline#15939

Merged
vkarpov15 merged 1 commit intomasterfrom
vkarpov15/gh-15928
Jan 5, 2026
Merged

fix(query): include preview of current and incoming update in error when merging normal update with pipeline#15939
vkarpov15 merged 1 commit intomasterfrom
vkarpov15/gh-15928

Conversation

@vkarpov15
Copy link
Collaborator

Re: #15928

Summary

@AbdelrahmanHafez 's comments on #15928 were accurate, I had a lot of trouble diagnosing the error in #15928 when I first ran into it.

Examples

@vkarpov15 vkarpov15 added this to the 9.1.1 milestone Jan 4, 2026
Copilot AI review requested due to automatic review settings January 4, 2026 21:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves error messages when mixing incompatible update types (array vs object) by including a preview of both the current and incoming updates. This enhancement makes it significantly easier to diagnose and fix issues related to mixing normal updates with pipeline updates.

Key changes:

  • Enhanced error messages to display previews of conflicting updates
  • Added _previewUpdate() helper function to format update objects for display

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/query.js Added _previewUpdate() helper function that uses util.inspect() to format update objects with appropriate constraints (depth, array length, total length), and updated three error messages to include current and incoming update previews
test/model.updateOne.test.js Added test case to verify that error messages include properly formatted previews when mixing array and object updates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vkarpov15 vkarpov15 modified the milestones: 9.1.1, 9.1.2 Jan 5, 2026
@vkarpov15 vkarpov15 merged commit 53d70cb into master Jan 5, 2026
56 checks passed
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-15928 branch January 5, 2026 21:34
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