@@ -28,84 +28,84 @@ func NewStageBuilder() *StageBuilder {
28
28
}
29
29
30
30
func (b * StageBuilder ) AddFields (value any ) * StageBuilder {
31
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : AddFieldsOp , Value : value }})
31
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageAddFieldsOp , Value : value }})
32
32
return b
33
33
}
34
34
35
35
func (b * StageBuilder ) Set (value any ) * StageBuilder {
36
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : SetOp , Value : value }})
36
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageSetOp , Value : value }})
37
37
return b
38
38
}
39
39
40
40
func (b * StageBuilder ) Bucket (groupBy any , boundaries []any , opt * BucketOptions ) * StageBuilder {
41
41
d := bson.D {
42
- bson.E {Key : GroupByOp , Value : groupBy },
43
- bson.E {Key : BoundariesOp , Value : boundaries },
42
+ bson.E {Key : StageGroupByOp , Value : groupBy },
43
+ bson.E {Key : StageBoundariesOp , Value : boundaries },
44
44
}
45
45
if opt != nil {
46
46
if opt .DefaultKey != nil {
47
- d = append (d , bson.E {Key : DefaultOp , Value : opt .DefaultKey })
47
+ d = append (d , bson.E {Key : StageDefaultOp , Value : opt .DefaultKey })
48
48
}
49
49
if opt .Output != nil {
50
- d = append (d , bson.E {Key : OutputOp , Value : opt .Output })
50
+ d = append (d , bson.E {Key : StageOutputOp , Value : opt .Output })
51
51
}
52
52
}
53
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : BucketOp , Value : d }})
53
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageBucketOp , Value : d }})
54
54
return b
55
55
}
56
56
57
57
func (b * StageBuilder ) BucketAuto (groupBy any , buckets int , opt * BucketAutoOptions ) * StageBuilder {
58
58
d := bson.D {
59
- bson.E {Key : GroupByOp , Value : groupBy },
60
- bson.E {Key : BucketsOp , Value : buckets },
59
+ bson.E {Key : StageGroupByOp , Value : groupBy },
60
+ bson.E {Key : StageBucketsOp , Value : buckets },
61
61
}
62
62
if opt != nil {
63
63
if opt .Output != nil {
64
- d = append (d , bson.E {Key : OutputOp , Value : opt .Output })
64
+ d = append (d , bson.E {Key : StageOutputOp , Value : opt .Output })
65
65
}
66
66
if opt .Granularity != "" {
67
- d = append (d , bson.E {Key : GranularityOp , Value : opt .Granularity })
67
+ d = append (d , bson.E {Key : StageGranularityOp , Value : opt .Granularity })
68
68
}
69
69
}
70
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : BucketAutoOp , Value : d }})
70
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageBucketAutoOp , Value : d }})
71
71
return b
72
72
}
73
73
74
74
func (b * StageBuilder ) Match (expression any ) * StageBuilder {
75
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : MatchOp , Value : expression }})
75
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageMatchOp , Value : expression }})
76
76
return b
77
77
}
78
78
79
79
func (b * StageBuilder ) Group (id any , accumulators ... bson.E ) * StageBuilder {
80
80
d := bson.D {{Key : "_id" , Value : id }}
81
81
d = append (d , accumulators ... )
82
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : GroupOp , Value : d }})
82
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageGroupOp , Value : d }})
83
83
return b
84
84
}
85
85
86
86
func (b * StageBuilder ) Sort (value any ) * StageBuilder {
87
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : SortOp , Value : value }})
87
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageSortOp , Value : value }})
88
88
return b
89
89
}
90
90
91
91
func (b * StageBuilder ) Project (value any ) * StageBuilder {
92
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : ProjectOp , Value : value }})
92
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageProjectOp , Value : value }})
93
93
return b
94
94
}
95
95
96
96
func (b * StageBuilder ) Limit (limit int64 ) * StageBuilder {
97
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : LimitOp , Value : limit }})
97
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageLimitOp , Value : limit }})
98
98
return b
99
99
}
100
100
101
101
func (b * StageBuilder ) Skip (skip int64 ) * StageBuilder {
102
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : SkipOp , Value : skip }})
102
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageSkipOp , Value : skip }})
103
103
return b
104
104
}
105
105
106
106
func (b * StageBuilder ) Unwind (path string , opt * UnWindOptions ) * StageBuilder {
107
107
if opt == nil {
108
- b .pipeline = append (b .pipeline , bson.D {{Key : UnwindOp , Value : path }})
108
+ b .pipeline = append (b .pipeline , bson.D {{Key : StageUnwindOp , Value : path }})
109
109
} else {
110
110
d := bson.D {{Key : "path" , Value : path }}
111
111
if opt .IncludeArrayIndex != "" {
@@ -114,28 +114,28 @@ func (b *StageBuilder) Unwind(path string, opt *UnWindOptions) *StageBuilder {
114
114
if opt .PreserveNullAndEmptyArrays {
115
115
d = append (d , bson.E {Key : "preserveNullAndEmptyArrays" , Value : opt .PreserveNullAndEmptyArrays })
116
116
}
117
- b .pipeline = append (b .pipeline , bson.D {{Key : UnwindOp , Value : d }})
117
+ b .pipeline = append (b .pipeline , bson.D {{Key : StageUnwindOp , Value : d }})
118
118
}
119
119
return b
120
120
}
121
121
122
122
func (b * StageBuilder ) ReplaceWith (replacementDocument any ) * StageBuilder {
123
- b .pipeline = append (b .pipeline , bson.D {{Key : ReplaceWithOp , Value : replacementDocument }})
123
+ b .pipeline = append (b .pipeline , bson.D {{Key : StageReplaceWithOp , Value : replacementDocument }})
124
124
return b
125
125
}
126
126
127
127
func (b * StageBuilder ) Facet (value any ) * StageBuilder {
128
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : FacetOp , Value : value }})
128
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageFacetOp , Value : value }})
129
129
return b
130
130
}
131
131
132
132
func (b * StageBuilder ) SortByCount (expression any ) * StageBuilder {
133
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : SortByCountOp , Value : expression }})
133
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageSortByCountOp , Value : expression }})
134
134
return b
135
135
}
136
136
137
137
func (b * StageBuilder ) Count (countName string ) * StageBuilder {
138
- b .pipeline = append (b .pipeline , bson.D {bson.E {Key : CountOp , Value : countName }})
138
+ b .pipeline = append (b .pipeline , bson.D {bson.E {Key : StageCountOp , Value : countName }})
139
139
return b
140
140
}
141
141
0 commit comments