Skip to content

Conversation

jamis
Copy link
Contributor

@jamis jamis commented Sep 9, 2025

When a hint was specified for an aggregate operation (e.g. Person.hint({ age: 1 }).aggregates(:age)) the hint was not being included with the constructed command. This PR fixes that.

@Copilot Copilot AI review requested due to automatic review settings September 9, 2025 15:01
@jamis jamis added the bug Fixes a bug, with no new features or broken compatibility label Sep 9, 2025
@jamis jamis requested a review from a team as a code owner September 9, 2025 15:01
@jamis jamis requested a review from comandeo-mongo September 9, 2025 15:01
Copy link
Contributor

@Copilot 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 fixes an issue where hints were not being passed to MongoDB aggregate operations in Mongoid. When a hint was specified using .hint() on a criteria (e.g., Person.hint({ age: 1 }).aggregates(:age)), the hint was not included in the MongoDB command.

  • Adds hint parameter to the aggregate operation call
  • Includes comprehensive test coverage for hint functionality in aggregate operations

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/mongoid/contextual/aggregable/mongo.rb Updates aggregates method to include hint parameter from view
spec/mongoid/contextual/aggregable/mongo_spec.rb Adds test cases to verify hint inclusion in aggregate commands

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jamis jamis merged commit 83a051c into mongodb:master Sep 15, 2025
63 checks passed
@jamis jamis deleted the 5887-hints-to-aggregates branch September 15, 2025 16:40
jamis added a commit to jamis/mongoid that referenced this pull request Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes a bug, with no new features or broken compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants