Open
Description
Hi, as I can see in different tutorials (ex. https://www.mongodb.com/blog/post/quick-start-golang--mongodb--data-aggregation-pipeline) they use mongo.Pipeline
which is []bson.D
. In code for SimpleAggregateCursorWithCtx
pipeline is bson.A
(not bson.D
which is ordered):
func (coll *Collection) SimpleAggregateCursorWithCtx(ctx context.Context, stages ...interface{}) (*mongo.Cursor, error) {
pipeline := bson.A{}
for _, stage := range stages {
if operator, ok := stage.(builder.Operator); ok {
pipeline = append(pipeline, builder.S(operator))
} else {
pipeline = append(pipeline, stage)
}
}
return coll.Aggregate(ctx, pipeline, nil)
}
Can you please say, if I want aggregation with $match
at first and $lookup
, can I use SimpleAggragation methods?
Metadata
Assignees
Labels
No labels
Activity