[SERVER-21200] $match w/ $text should not use DocumentSource::setSource() to enforce pipeline position Created: 29/Oct/15  Updated: 06/Dec/22  Resolved: 04/Dec/17

Status: Closed
Project: Core Server
Component/s: Aggregation Framework, Internal Code
Affects Version/s: 3.2.0-rc1
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: James Wahlin Assignee: Backlog - Query Team (Inactive)
Resolution: Done Votes: 0
Labels: optimization
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query
Participants:

 Description   

A $match clause run with $text must be in the first position of an aggregation pipeline. Our current handling for this has DocumentSource::isValidInitialSource() returning false (which is not logically correct when $text is present) paired with a uassert in DocumentSource::setSource to enforce. We should change the way this is handled so that the DocumentSourceMatch interface reports correct information and so that pipeline position validation can be handled externally.



 Comments   
Comment by David Storch [ 04/Dec/17 ]

This is now handled by Pipeline::ensureAllStagesAreInLegalPositions():

https://github.com/mongodb/mongo/blob/026d66c44aff1c9da78b72c0825bdecc16ae968f/src/mongo/db/pipeline/pipeline.cpp#L215-L218

Generated at Thu Feb 08 03:56:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.