Conversation
…hen merging normal update with pipeline Re: #15928
Contributor
There was a problem hiding this comment.
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.
AbdelrahmanHafez
approved these changes
Jan 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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