-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Labels:
-
Fully Compatible
-
Query 2016-10-31
We currently have a bit of a weird setup of DocumentSources and their unit tests:
- All DocumentSources are declared within the same header file: src/mongo/db/pipeline/document_source.h. This isn't so bad, but makes it harder to jump back and forth between the header and the cpp file.
- Each DocumentSource implementation is declared in its own file, e.g. src/mongo/db/pipeline/document_source_match.cpp.
- All unit tests live in one file: src/mongo/db/pipeline/document_source_test.cpp, but each implementation has it's own namespace, with some common types of tests in each namespace, sometimes with identical names. This is quite annoying to navigate.
- Since
SERVER-19542was resolved, some tests in src/mongo/db/pipeline/pipeline_test.cpp are testing functionality that is now the responsibility of the DocumentSource itself.
We should resolve these discrepancies by adding a separate header file and test file for each DocumentSource, and moving the tests from pipeline to the new test files as appropriate. It may be worthwhile to create a sub-directory within src/mongo/db/pipeline for DocumentSources.