Skip to content

Conversation

@patrickpasquini
Copy link
Contributor

This PR fixes the pipeline stage ordering in the mount_base_pipeline function when populate=True. The reference stage was being placed after sort, skip, and limit stages, which could lead to incorrect query results.

Changes

  • Move reference_stage to execute before sort_stage, skip_stage, and limit_stage in the pipeline
  • This ensures population of references happens before sorting and pagination operations

Why this matters

The previous order could cause issues when:

  • Sorting by fields from populated references
  • The populated data affects the sorting

@mauro-andre mauro-andre merged commit 69b83c5 into mauro-andre:master Jul 16, 2025
1 check passed
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.

2 participants