v0.0.437 properly handle $group in wmo extraModPipeline
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 3m23s

This commit is contained in:
2024-04-23 16:12:17 +02:00
parent b876c64ba2
commit 764ce79a71
6 changed files with 44 additions and 9 deletions

View File

@@ -36,6 +36,14 @@ func (c *Coll[TData]) Find(ctx context.Context, filter bson.M, opts ...*options.
pipeline = langext.ArrConcat(pipeline, ppl(ctx))
}
if c.needsDoubleSort(ctx) {
for _, opt := range opts {
if opt != nil && opt.Sort != nil {
pipeline = append(pipeline, bson.D{{Key: "$sort", Value: opt.Sort}})
}
}
}
for _, opt := range opts {
if opt != nil && opt.Projection != nil {
pipeline = append(pipeline, bson.D{{Key: "$project", Value: opt.Projection}})