Skip to content

Commit 6952cb2

Browse files
committed
Fix stages in the aggregate pipeline
1 parent a113fe5 commit 6952cb2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

uploader/pipelines/trends_course_and_prof_section.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
)
77

88
var TrendsCourseProfSectionsPipeline = mongo.Pipeline{
9-
109
bson.D{
1110
{Key: "$lookup",
1211
Value: bson.D{
@@ -18,7 +17,7 @@ var TrendsCourseProfSectionsPipeline = mongo.Pipeline{
1817
},
1918
},
2019
bson.D{
21-
{Key: "$group",
20+
{Key: "$project",
2221
Value: bson.D{
2322
{Key: "subject_prefix", Value: 1},
2423
{Key: "course_number", Value: 1},
@@ -48,7 +47,7 @@ var TrendsCourseProfSectionsPipeline = mongo.Pipeline{
4847
bson.D{
4948
{Key: "$unwind",
5049
Value: bson.D{
51-
{Key: "path", Value: "$sections"},
50+
{Key: "path", Value: "$professors"},
5251
{Key: "preserveNullAndEmptyArrays", Value: false},
5352
},
5453
},
@@ -63,7 +62,9 @@ var TrendsCourseProfSectionsPipeline = mongo.Pipeline{
6362
Value: bson.A{
6463
"$subject_prefix",
6564
"$course_number",
65+
" ",
6666
"$professors.first_name",
67+
" ",
6768
"$professors.last_name",
6869
},
6970
},

uploader/uploader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func Upload(inDir string, replace bool, staticOnly bool) {
6565
buildStaticAggregation(client, ctx, "sections", "events", pipelines.EventsPipeline)
6666
buildStaticAggregation(client, ctx, "courses", "trends_course_sections", pipelines.TrendsCourseSectionsPipeline)
6767
buildStaticAggregation(client, ctx, "professors", "trends_prof_sections", pipelines.TrendsProfSectionsPipeline)
68-
buildStaticAggregation(client, ctx, "courses+professors", "trends_course_and_prof_section", pipelines.TrendsCourseProfSectionsPipeline)
68+
buildStaticAggregation(client, ctx, "courses", "trends_course_and_prof_sections", pipelines.TrendsCourseProfSectionsPipeline)
6969

7070
log.Print("Done building static aggregations!")
7171
}

0 commit comments

Comments
 (0)