-
Type:
Sub-task
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Integration
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Background
$search will desugar into [$_documentResultsAndMetadata, $_idLookup], where $_documentResultsAndMetadata.$extensionSearch will need the view namespace and $_idLookup will apply the view pipeline.
$_documentResultsAndMetadata First Stage View Application Policy
FirstStageViewApplicationPolicy LiteParsedDocumentResultsAndMetadata::getFirstStageViewApplicationPolicy() const override { return FirstStageViewApplicationPolicy::kDoNothing; }
$documentResultsAndMetadata is a source stage and should _never append the view before the source stage that it contains. This is true for all source stages; we should not be running stages prior to getting the “source” of documents.
$_documentResultsAndMetadata ** bindViewInfo() Implementation
$_documentResultsAndMetadata is not technically a sub-pipeline stage as it only holds a single source stage, but it should operate in the same way. This means that its bindViewInfo() implementation has the responsibility of applying the view to its source stage. For our specific $search example, this will allow $extensionSearch to receive the view information.
void LiteParsedDocumentResultsAndMetadata::bindViewInfo( const ViewInfo& viewInfo, const ResolvedNamespaceMap& resolvedNamespaces) override { _source.bindViewInfo(viewInfo, resolvedNamespaces);
Testing
Unit Tests
- $_documentResultsAndMetadata does not prepend the view.
- bindViewInfo() propagates the view to the stage in $_documentResultsAndMetadata.
- depends on
-
SERVER-126150 Add skeleton for DocumentSourceInternalResultsAndMetadata stage
-
- In Code Review
-
- is depended on by
-
SERVER-127560 Add $_internalDocumentResultsAndMetadata-on-views integration tests
-
- In Code Review
-