RUBY-3520 Sort option for updateOne and replaceOne#2938
Merged
comandeo-mongo merged 5 commits intomongodb:masterfrom Sep 8, 2025
Merged
RUBY-3520 Sort option for updateOne and replaceOne#2938comandeo-mongo merged 5 commits intomongodb:masterfrom
comandeo-mongo merged 5 commits intomongodb:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds sort option support for updateOne and replaceOne operations, allowing MongoDB users to specify which document should be updated/replaced when multiple documents match the filter criteria. The sort option determines the order in which documents are considered, with the first document in the sort order being selected for the operation.
- Adds sort option parameter handling to updateOne and replaceOne methods
- Includes test coverage for both standalone operations and bulk write operations
- Supports the new MongoDB 8.0+ server feature with appropriate version checks
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/spec_tests/data/crud_unified/updateOne-sort.yml | Test specification for updateOne with sort option |
| spec/spec_tests/data/crud_unified/replaceOne-sort.yml | Test specification for replaceOne with sort option |
| spec/spec_tests/data/crud_unified/bulkWrite-updateOne-sort.yml | Test specification for bulkWrite updateOne with sort option |
| spec/spec_tests/data/crud_unified/bulkWrite-replaceOne-sort.yml | Test specification for bulkWrite replaceOne with sort option |
| spec/runners/unified/crud_operations.rb | Adds sort parameter handling in test runner for updateOne, replaceOne, and bulk operations |
| lib/mongo/collection/view/writable.rb | Implements sort option in updateOne and replaceOne methods with documentation |
| lib/mongo/collection.rb | Adds documentation for sort option in collection-level methods |
| lib/mongo/bulk_write/transformable.rb | Adds sort option support to bulk write transformations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jamis
previously approved these changes
Sep 2, 2025
jamis
approved these changes
Sep 5, 2025
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.
No description provided.