@ptkl/sdk - v1.7.1
    Preparing search index...

    Type Alias UpdateAggregate

    UpdateAggregate: Record<string, any>[]

    A single element in an $aggregate update array. Each element is a plain object mapping field names to MongoDB aggregation expressions. You do not need to wrap the object in a $set — the API does that automatically.

    const update: UpdateAggregate = [
    {
    avg_rating: { $avg: "$ratings" },
    tier: { $cond: { if: { $gte: ["$avg_rating", 4.5] }, then: "platinum", else: "standard" } }
    }
    ]